e01ddf1MATLAB-syntax scripts on WebGPU: fused kernels, tic/toc timing, CPU comparisonJeremy Magland 1% Reductions take a fused loader: dot, norm and max each read their
2% operands exactly once -- sum(a.*b) is one pass, not two.
3n = 10000000;
4a = rand(n, 1);
5b = rand(n, 1);
6tic;
7d = dot(a, b);
8nrm = norm(a - b);
9mx = max(abs(a - b));
10toc
11fprintf('dot %.0f norm %.2f max %.6f\n', d, nrm, mx);