Avoiding unnecessary attention work

The tiled attention shader checks the mask for the query rows and skips KV tiles that are completely hidden. Those tiles do not need their key data loaded or their attention matrix work performed. A separate layout change pads shared-memory K rows with two f16 elements to avoid bank conflicts for particular head dimensions. The new stride belongs to the tile kernel; the vector and subgroup-matrix paths do not automatically receive the same layout change.

Changing normalization scheduling

For RMS_NORM_MUL inputs containing at least 64 rows, the implementation chooses a workgroup of up to 128 threads instead of the device maximum. Its size becomes part of the pipeline cache key, keeping shader variants distinct. Smaller row counts retain the previous large workgroup. The shader also computes a square by multiplying a value by itself instead of calling pow, whose WGSL behavior is undefined for negative inputs. The final diff therefore combines scheduling changes with a more direct arithmetic expression.

What the benchmark actually measures

The author tested wllama in Chrome 156 on an Apple M5 Max without unsafe flags, using an approximately 980-token prompt and the median of three alternating runs. Qwen3-0.6B Q4_K_M prompt processing rose from 1,598 to 2,717 tokens per second, a 70% increase, while generation was nearly unchanged. LFM2-1.2B Q4_K_M improved by only 1.6% in prefill. A reviewer also reported improvements in separate native WebGPU tests. These are developer measurements, not an independent newsroom benchmark.

Limits for application developers

Our interpretation is that reducing prompt work can help local browser applications, particularly those repeatedly ingesting longer inputs. A prefill improvement should nevertheless be evaluated separately from sequential token generation. The author also provides Dawn/Vulkan results on an RTX 5060 Ti with different subgroup-matrix settings, demonstrating that backend capabilities affect the outcome. The pull request displayed 27 passing checks out of 28. Finally, merging an upstream optimization does not establish that every downstream browser application has already updated its bundled inference runtime.