advanced
Fast at 1023 Columns, Slow at 1024
Read the counters before the options. Nothing here is labelled with the answer.
The report
Our image convolution has a column-summing pass. It runs fine on most images. On one specific size it takes about six times longer, and the sizes either side of it are fine. Someone suggested it is a coincidence in our test data, but it reproduces every time on exactly that width.
The column pass — stride equals the row width
// matrix is row-major, width columns per row
for col in 0 .. width-1:
sum = 0
for row in 0 .. height-1:
sum += matrix[row * width + col] // stride = width elements
out[col] = sumCountersSIMULATED
| instructions | identical at width 1023 and 1024 | The same work is performed at both widths, to within noise. |
| cycles | 6.1× higher at width 1024 | One specific width takes six times as many cycles for identical work. |
| L1-dcache-load-misses | 3.1% at 1023, 97.4% at 1024 | Nearly every load misses at the problem width; almost none do next to it. |
| LLC-load-misses | 2.9% at 1023, 3.2% at 1024 | The amount of data reaching main memory is essentially unchanged. |
| dTLB-load-misses | 0.6% at both widths | Address translation is not a differentiator here. |
What is the hardware doing?