Single source of truth for every constant the JS dispatch side shares with a
shader.
WGSL has no import mechanism, so each shader necessarily declares its own
copy of these values. That makes them a silent-corruption hazard: change
BM in sgemm_large.wgsl without changing BM_LARGE here and the host
dispatches the wrong grid — too few workgroups computes part of the matrix
and reports success. Hoisting them here removes the JS-to-JS duplication;
tests/utils/test.constants.js closes the remaining JS-to-WGSL gap
by parsing the shader sources and asserting they still agree.
Every export below names the shader declaration it mirrors. Changing one
means changing both, and the test will tell you if you forget.
Single source of truth for every constant the JS dispatch side shares with a shader.
WGSL has no import mechanism, so each shader necessarily declares its own copy of these values. That makes them a silent-corruption hazard: change
BMinsgemm_large.wgslwithout changingBM_LARGEhere and the host dispatches the wrong grid — too few workgroups computes part of the matrix and reports success. Hoisting them here removes the JS-to-JS duplication;tests/utils/test.constants.jscloses the remaining JS-to-WGSL gap by parsing the shader sources and asserting they still agree.Every export below names the shader declaration it mirrors. Changing one means changing both, and the test will tell you if you forget.