Compiler optimizations to reduce cache misses

Compiler optimizations to reduce cache misses

-> Reduce “reuse distance” the amount of memory accesses between accesses of the same memory block. If reuse distance is too big, the data is probably out of the cache alredy

Strip mining #

Strip mining with loop interchange #

  • instead of iterating over the big array multiple times, iterate the multiple times over small blocks

Data transformations #

Alignment #

Align data structure such that it begins on a cache line boundary

Array Padding #

  • to prevent collisions for direct mapped caches

Array element reordering #

Array merging #

Calendar October 22, 2023