[ExecuTorch][WebGPU] f16-accumulate (pwdqf16acc) steel q4gsw prefill GEMM#20800
Open
JCNTH wants to merge 1 commit into
Open
[ExecuTorch][WebGPU] f16-accumulate (pwdqf16acc) steel q4gsw prefill GEMM#20800JCNTH wants to merge 1 commit into
JCNTH wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20800
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 1 Unrelated FailureAs of commit d29f101 with merge base 4af91c3 ( NEW FAILURES - The following jobs have failed:
FLAKY - The following job failed but was likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Jul 9, 2026
Open
This PR needs a
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack (oldest at bottom):
+46-56% end-to-end prefill tok/s over the shipped f16
steelq4gsw GEMM (Apple M4 Pro / Chrome Canary), behind a new opt-in build flag; perplexity held (13.32 -> 13.37, +0.05).Problem: the f16
steelprefill GEMM (and its packed-word-dequant variantpwdq) accumulates its 4x4 register tile in f32. WebLLM/MLC accumulate in f16, which halves the accumulator footprint and raises occupancy — the largest remaining prefill gap vs MLC on Apple.Solution: an f16-accumulate variant of the
pwdqkernel — identical staging (dequant-once + hoisted scale) and 64x64/256-thread/BK=16 geometry, but the 4x4 accumulator is kept in f16 withfma()(mirrors MLC'sarray<f16,16>reduction) and cast to f32 in the epilogue for the f32 output/bias.Before (
pwdq): f16 multiply, f32 accumulate.After (
pwdqf16acc): f16 multiply, f16 accumulate, f32 epilogue.Implementation:
q4gsw_linear_gemm_steel_half_pwdqf16acc.wgsl(+ generated header) + a new CMake optionEXECUTORCH_WEBGPU_STEEL_F16ACC(default OFF, mirrorsEXECUTORCH_WEBGPU_STEEL_F16) ->WGPU_BACKEND_STEEL_F16ACC.group_size % BK == 0; else the f32-accumulatepwdq/half/ f32 kernels run (fail-closed).Constraints: LOSSY — f16 accumulation over the full K (up to 8192) is not bit-exact, so it ships on a perplexity bar, not a bit-exact gate (as MLC does): measured Llama-3.2-1B int4 perplexity 13.32 -> 13.37 (+0.05) on the real prefill path. Default-OFF keeps upstream builds on the strict f32-accumulate golden; the option is opt-in for latency-sensitive deployments.
Co-authored-with: Claude Code.
Differential Revision: D111163606