[ExecuTorch][WebGPU] Add linear_dq8ca_q4gsw + choose_qparams_affine (8da4w)#21229
[ExecuTorch][WebGPU] Add linear_dq8ca_q4gsw + choose_qparams_affine (8da4w)#21229JCNTH wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21229
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ❌ 46 New Failures, 3 Unrelated FailuresAs of commit d777733 with merge base 266e0dc ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
BROKEN TRUNK - The following job failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
psiddh
left a comment
There was a problem hiding this comment.
Approving full WebGPU stack
Stack from ghstack (oldest at bottom):
Problem: WebGPU lacked the dynamic-8bit-activation x 4-bit-group-weight linear (the 8da4w path real LLMs use for dynamic quant). Vulkan registers
et_vk.linear_dq8ca_q4gsw+torchao.choose_qparams_affine; WebGPU delegated neither, so anyInt8DynamicActivationIntxWeightConfigmodel fell back to CPU.Solution: Author the reachable pair.
torchao.choose_qparams_affinecomputes per-row asymmetric int8 activation scale/zp;et_vk.linear_dq8ca_q4gswfolds that dynamic activation quant into the existing q4gsw 4-bit-group GEMM. Both mirror the Vulkan reference (ChooseQParams.cpp,QuantizedLinear.cpp:760); the activation-quant + weight-dequant math was CPU-de-risked exact against torchao before authoring.Impl:
choose_qparams_affine.wgsldoes a cooperative per-row min/max reduction (one workgroup per block of 4 rows so the 4 int8 zps pack into one u32 with no write race) thencalculate_scale_and_zero_pointmirroring Vulkan.linear_dq8ca_q4gsw.wgslis the register-tiled q4gsw GEMM without[m,n] = s[m] * sum_k (xq[m,k]-z[m]) * dequant(w), reading the packed-int8 zp. int8 zp (elem_size1) is bound word-aligned;num_rowsmust be <=4 or a multiple of 4 (int8 buffers allocmax(nbytes,4)) — arbitrary-M prefill is a documented follow-up.Differential Revision: D112257680