Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best resource for learning about prefetching a buffer in C on Intel/AMD 64 bit

I am interested in mastering prefetch-related functions such as

_mm_prefetch(...)

so when I perform operations that loop over arrays, the memory bandwidth is fully utilized. What are the best resources for learning about this?

I am doing this work in C using GCC 4 series on an intel linux platform.

like image 807
Setjmp Avatar asked Oct 29 '08 01:10

Setjmp


2 Answers

There is also an excellent paper by Ulrich Drepper, What Every Programmer Should Know About Memory. He covers prefetching, plus many other topics dealing with memory performance optimization. It was released in Nov 2007, and is extremely relevant for today's processors. If you're performing operations on very large arrays and believe your bottleneck is getting to memory, you should read it.

like image 88
DGentry Avatar answered Sep 24 '22 21:09

DGentry


This site contains details on gcc prefetch support including prefetch options and functions and includes details on several architectures including Intel. The gcc manual contains details on the __builtin_prefetch built-in function in section 5.46.

like image 4
Robert Gamble Avatar answered Sep 20 '22 21:09

Robert Gamble