Sixty Four Is Too Big
The CS:APP blocked matrix multiply keeps a bsize by bsize block of B resident while the i loop sweeps n row slivers of A and C past it:
for (kk = 0; kk < en; kk += bsize)
for (jj = 0; jj < en; jj += bsize)
for (i = 0; i < n; i++)
for (j = jj; j < jj + bsize; j++) {
sum = C[i][j];
for (k = kk; k < kk + bsize; k++)
sum += A[i][k] * B[k][j];
C[i][j] = sum;
}
Elements are doubles and L1d is 32 KB. An engineer reasons "a bigger block means more reuse" and sets bsize = 64. What actually happens?
Sign in to answer questions and track your progress
Sign In