WebGL2-compute based NxN matrix multiplication C = A x B benchmark.
Fixed random A, B 4096x4096 buffers are used for calculations,
therefore You can set new N value (up to N=4096, multiple of TS).
6 shaders Sh1, 2 with tile sizes (local_size_x,y) TS = 8, 16, 32
are precompiled.
it - number of iterations. FLOPS = 2 N3 / Tmin.
calculating
N=
TS=
Sh=
it=
GeForce RTX 2070, OpenGL backend, Windows 10, 64 bit (N=4096, TS=32)
"Naive" shader 0.75 TFLOPS
"Tiled" shader 1.11 TFLOPS.
I re-run all programs many times (press "Run" button)
and try to choose "highest representative" values.
Set N = 128 to see overheads (~1.4 ms).
Comments
Dummy operator gl.getBufferSubData()
gl.dispatchCompute(N/TS, N/TS, 1)
gl.memoryBarrier(gl.SHADER_STORAGE_BARRIER_BIT)
gl.getBufferSubData(gl.SHADER_STORAGE_BUFFER, 0, result)
var ti = performance.now()