[ExecuTorch][WebGPU] Add q8ta_conv2d_pw op (int8 pointwise conv)#21199
[ExecuTorch][WebGPU] Add q8ta_conv2d_pw op (int8 pointwise conv)#21199JCNTH wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21199
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: ❌ 37 New Failures, 3 Unrelated FailuresAs of commit 522cfe1 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: The WebGPU delegate has no quantized pointwise (1x1) convolution. A plain 1x1
nn.Conv2dthrough XNNPACK static PT2E lowers to a delegatedquantize_per_tensor -> q8ta_conv2d_pw -> dequantize_per_tensorsubgraph; the quantize/dequantize are the landed C0 ops, soq8ta_conv2d_pwis the one missing piece to run a quantized 1x1 conv end-to-end.Solution: Port
et_vk.q8ta_conv2d_pw(int8 activation x int8 per-channel weight -> int8). A 1x1 conv is a per-(H,W)-position channel dot:acc = Σ_ic (x_int8[n,ic,h,w] - input_zero_point) * weight_int8[oc,ic], dequantizeacc * input_scale * weight_scales[oc] + bias, requantizeclamp(round(v * inv_output_scale) + output_zero_point, -128, 127), packed 4 int8 per word. Mirrors Vulkanq8ta_conv2d_pw(Q8taConv2dPW.cpp+q8ta_conv2d_pw.glsl).Implementation:
Q8taConv2dPw.cppregistersq8ta_conv2d_pw.default,out = args.back(), one thread per output word = 4 consecutiveWpositions of a fixed(n, oc, h)(W % 4 == 0for output word alignment), 2D dispatch fold to lift the 65535 cap. Guards int8 x/weight/out +[N,IC,H,W]/[OC,IC]/[N,OC,H,W]ranks, and scopes tostride=1/pad=0/dilation=1/groups=1/activation="none"(all fail-loud).Q8taConvPwParamsis a 48-byte (16-aligned) uniform.Constraints / divergences from the Vulkan reference (numerically equivalent, golden-verified): (1) the
weight_sumsarg is unused — the input zero-point correction is folded per-element (Σ(x-zp)·w == Σx·w - zp·Σw). (2) x/weight/out are read row-major NCHW /[OC,IC](WebGPU's always-buffer convention; C0quantize_per_tensoremits row-major int8 and the WebGPU prepack is a passthrough), not Vulkan's int8x4-block-packed 4W4C layout — consistent with the landedq8ta_linear.Differential Revision: D112257662