size tflops_cublas tflops_my diff gpu
12288² 51.4 56.3 +9% h100
8192² 50.5 56.1 +11% h100
4096² 43.8 53.9 +23% h100
12288² 18.9 27.0 +43% a100
8192² 19.0 26.3 +38% a100
4096² 17.5 19.8 +13% a100
12288² 28.8 34.5 +20% 3090tiE.g. consider the line:
sum[y2*8 + x2] += ...
In the final loop iteration when y2=15 and x2=7, the index is 127.You can look at the generated sass on godbolt: https://cuda.godbolt.org/z/19excTxM3
Note that there are 1024 FFMA instructions in the loop but you would expect 16*8*BK = 2048. This would suggest half the operations are skipped, which lines up with the half of writes that are out of bounds being omitted.
After the compute loop when you're calculating the final result and storing it, you can see that the FFMAs referencing out of bounds indices write QNAN instead of any real results.
Is it possible that the NANs are what are messing with your tests? Those are notoriously hard to deal with correctly, but you should assert that the result doesn't have any NANs whatsoever.
It definitely sucks to be led astray and have time wasted by a bug inherited from the original repo though, sorry to hear that :/
Source code: https://github.com/arekpaterek/Faster_SGEMM_CUDA