Exactly Thirty Two Kilobytes
A machine has one 32 KB L1 data cache: 8-way set associative, 64-byte lines, LRU. Nothing else competes for it.
A double a[64][64] is allocated at a 4096-byte aligned address, so the whole array is exactly 32 KB. It is traversed column by column:
double s = 0.0;
for (int j = 0; j < 64; j++)
for (int i = 0; i < 64; i++)
s += a[i][j];
s, i and j live in registers. How many L1d misses does this loop take?
Sign in to answer questions and track your progress
Sign In