Le 06/09/2021 à 19:45, Antoine Pitrou a écrit :
Specifically, I performed two types of tests, a "random sum" where we
compute the sum of the values taken at random indices, and "sum", where we
sum all values of the array (buffer[1] of the primitive array), both for
array ranging from 2^10 to 2^25 elements. I was expecting that, at least in
the latter, prefetching would help, but I do not observe any difference.
By prefetching, you mean explicit prefetching using intrinsics?
Modern CPUs are very good at implicit prefetching, they are able to
detect memory access patterns and optimize for them. Implicit
prefetching would only possibly help if your access pattern is
complicated (for example you're walking a chain of pointers).
Oops: *explicit* prefecting would only possibly help.... sorry.
Regards
Antoine.
If your
access is sequential, there is zero reason to prefetch explicitly
nowadays, AFAIK.
Regards
Antoine.