News for hackers. Stuff that matters.
Re:What programmers need to know about hardware prefetching? by squeed on Monday August 29, 2011 @02:58PM (#2938337)
The article really only touches on the absolute basics. It would have left me hurting for more specifics. However, I've read Ulrich Drepper's epic paper on modern memory architectures. (http://lwn.net/Articles/259710/)

You should do yourself a favor and read it.

Re:What programmers need to know about hardware prefetching? by ChuckMcM on Monday August 29, 2011 @03:30PM (#2938486)
+10, best article on memory ever. If a similar treatment showed up on branch prediction we would have an excellent pair.
Re:What programmers need to know about hardware prefetching? by rcfox on Monday August 29, 2011 @01:59PM (#2938110)
Is this different from caches? If so, the advice also applies to properly using the cache. I've read that cache misses are the biggest source of slow-downs on modern processors. (Sorry, no citation)
Re:What programmers need to know about hardware prefetching? by tech_junkie on Monday August 29, 2011 @02:30PM (#2938237)
This is related to caches as the author is talked about hardware prefetching from memory to caches, i.e., is the act of fetching in to the cache the data that will be needed in the near future. This reduces cache misses.
Re:What programmers need to know about hardware prefetching? by zwieback on Monday August 29, 2011 @02:12PM (#2938166)
Nice introduction to data prefetching. I don't fully agree with this statement, though:

Second, programmers have very little control over instruction placement in memory.

Depending on your platform and type of application you may have full control over instruction placement and it might be extremely important to know how to sequence instructions to get maximum performance.

Re:What programmers need to know about hardware prefetching? by Hoff on Monday August 29, 2011 @09:09PM (#2939711)
It's certainly possible to have that control via assembler, where folks are programming in that. So strictly speaking, yes, your "may" can be true.

For C or another language, here's some related reading on that topic, and where you can get into deep trouble with this:

http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/pldi05... http://www.hpl.hp.com/personal/Hans_Boehm/misc_slides/reorde... http://www.hpl.hp.com/techreports/2005/HPL-2005-217R1.pdf http://www.hpl.hp.com/techreports/2004/HPL-2004-209.pdf

Re:What programmers need to know about hardware prefetching? by keeperofdakeys on Monday August 29, 2011 @07:32PM (#2939470)
Assuming he is talking about languages like C, and you don't use inline assembly, I don't see how you can have any control. For anything complex, your compiler will probably do a much better job then you in creating fast assembly.In the case you can do better, you would just inline the code, so you only have control over that small part.