[ExecuTorch][WebGPU] Broadcast add.Tensor (mirror mul) + un-skip 6 models#21233
[ExecuTorch][WebGPU] Broadcast add.Tensor (mirror mul) + un-skip 6 models#21233JCNTH wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21233
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: ❌ 27 New Failures, 4 Unrelated FailuresAs of commit 4d87cce 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):
add.Tensorwas elementwise-only:binary_add.wgslcomputedoutput[idx] = input1[idx] + alpha * input2[idx]over a single flat index up to the output numel, so on a broadcast it read the smaller operand out of bounds (WebGPU robustness clamps/zeros -> silently wrong, not0x30). This is the failure mode behind the models the WebGPU flow skips (resnet50,vit_b_16,swin_v2_t,convnext_small,mobilenet_v3_small,shufflenet_v2_x1_0) and thebcast_first/bcast_secondop cases.Give
add.TensorNumPy broadcasting by mirroring the shippedmul:binary_add.wgsl- copybinary_mul's kernel (rank-8TensorMetalayout from the rank-cap fix below it in the stack): keep the identical-shape elementwise fast path (common case stays bit-for-bitinput1[idx] + alpha * input2[idx]), else relinearize out idx -> per-input coords (clamp size-1 dims) and add.alphais a second pipeline-override constant (read once at build, never rewritten on resize), so no extra UBO.add/BinaryOp.cpp- portmul_impl: 3TensorMetaUBOs viafill_tensor_meta_broadcast, rank + fp32 guards, 6-entry bind group,constantCount = 2({wg_size, alpha}), 2D dispatch, andmul's resize hook verbatim (rebuild the 3 metas fromcur_dims,set_cur_dims, rewrite UBOs + dispatch);own_uniform_bufferthe 3 metas. Drops the old flatAddParamspath.flows/webgpu.py- un-skip the 6 broadcast-add models + thebcast_first/bcast_secondop cases (kept thefloat16/float64dtype skips andhardswish/lstm_batch_sizes/upsample_nearest2d).This sits above the rank-cap fix, so the shader uses the rank-8
array<vec4<u32>, 2>TensorMetalayout. Applied identically to bothxplat/andfbcode/mirrors (byte-identical).Co-authored-with: Claude Code.
Differential Revision: D113319599