[ExecuTorch][WebGPU] Add mul op with full broadcast (aten.mul.Tensor)#20358
Closed
JulianCloudNTH wants to merge 2 commits into
Closed
[ExecuTorch][WebGPU] Add mul op with full broadcast (aten.mul.Tensor)#20358JulianCloudNTH wants to merge 2 commits into
JulianCloudNTH wants to merge 2 commits into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20358
Note: Links to docs will display an error until the docs builds have been completed. ❌ 5 New Failures, 6 Pending, 2 Unrelated FailuresAs of commit b2df1c9 with merge base eb7473b ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This was referenced Jun 17, 2026
This PR needs a
|
JulianCloudNTH
added a commit
that referenced
this pull request
Jun 18, 2026
Pull Request resolved: #20358 Adds `aten.mul.Tensor` to the WebGPU delegate with full PyTorch broadcast, plus the shared `runtime/ops/TensorMeta.h` per-tensor uniform that broadcast ops reuse. Mul is on the Llama critical path — `F.silu` decomposes to `sigmoid` + `mul`, and SwiGLU multiplies two same-shape activations (the fast path). Composition (single dispatch): - `TensorMeta.h` (NEW) — 48-byte std140 `{ndim, numel, sizes[4], strides[4]}` UBO mirroring Vulkan's per-tensor `BufferMetadata`; `fill_tensor_meta_broadcast` right-aligns operand dims (rank>4 throws); `static_assert(sizeof==48)`. - `mul/BinaryOp.cpp` — builds 3 `TensorMeta` UBOs (out/in1/in2 at bindings 3/4/5), guards fp32 + rank≤4, 1D-dispatches over `compute_1d_workgroup_count(numel)`, releases all uniforms after the bind group. - `mul/binary_mul.wgsl` — same-shape fast path + a broadcast path (delinearize output index, clamp each input coord per-dim to size-1, relinearize on input strides). - `WebGPUUtils.h` — adds the shared `utils::make_uniform` helper (first use). ghstack-source-id: 394848336 @exported-using-ghexport Differential Revision: [D108793167](https://our.internmc.facebook.com/intern/diff/D108793167/)
psiddh
approved these changes
Jun 18, 2026
Contributor
|
This pull request has been merged in 0e65ba6. |
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):
Adds
aten.mul.Tensorto the WebGPU delegate with full PyTorch broadcast, plus the sharedruntime/ops/TensorMeta.hper-tensor uniform that broadcast ops reuse. Mul is on the Llama critical path —F.siludecomposes tosigmoid+mul, and SwiGLU multiplies two same-shape activations (the fast path).Composition (single dispatch):
TensorMeta.h(NEW) — 48-byte std140{ndim, numel, sizes[4], strides[4]}UBO mirroring Vulkan's per-tensorBufferMetadata;fill_tensor_meta_broadcastright-aligns operand dims (rank>4 throws);static_assert(sizeof==48).mul/BinaryOp.cpp— builds 3TensorMetaUBOs (out/in1/in2 at bindings 3/4/5), guards fp32 + rank≤4, 1D-dispatches overcompute_1d_workgroup_count(numel), releases all uniforms after the bind group.mul/binary_mul.wgsl— same-shape fast path + a broadcast path (delinearize output index, clamp each input coord per-dim to size-1, relinearize on input strides).WebGPUUtils.h— adds the sharedutils::make_uniformhelper (first use).@exported-using-ghexport
Differential Revision: D108793167
Differential Revision: D108793167