[ExecuTorch][WebGPU] Add dynamic-shape resize hook to cat (output mismatch)#21232
[ExecuTorch][WebGPU] Add dynamic-shape resize hook to cat (output mismatch)#21232JCNTH wants to merge 1 commit into
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21232
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: ❌ 28 New Failures, 3 Unrelated FailuresAs of commit bcb2ce9 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):
Under dynamic shapes
catproduced a wrong (scrambled + tail-garbage) output.cat_implbaked every shape-dependent quantity - each inputin_meta(strides/numel), the sharedout_meta(strides), the per-inputoff_k, and each dispatch'sworkgroup_count- from the MAX (upper-bound) build shape and registered NO resize hook, then released the UBOs. Under a smaller live shape the kernel then decoded coords with max strides, scattered with max out-strides, and looped over the max numel. This is the[dynamic]output-mismatch behindtest_inception_v3,test_squeezenet1_1,test_densenet161(all channel-cat on spatial-dynamic feature maps; the concat dim is static sooff_kwas already correct - the defect is the stale spatial strides/numel).Fix (mirrors the WebGPUGraph SwiGLU/QKV resize templates and the shipped
mulhook):in_meta/paramsUBOs and the sharedout_metaUBO alive viaown_uniform_buffer(previously released after build); collect their handles plus eachadd_dispatchindex.add_tensor_resize_hookon every input id: fromcur_dimsrecompute live out dims (set_cur_dims(out_id, ...)to cascade to consumers + fix the delegate-output shape), rebuildout_meta+ each input'sin_meta/paramsandwgpuQueueWriteBufferthem, and rewrite each dispatch'sworkgroup_count_xviacompute_1d_workgroup_count. On a static graphcur_dims == dims, so the hook rewrites identical values (no behavior change).Applied identically to both the
xplat/andfbcode/mirrors (byte-identical).Co-authored-with: Claude Code.
Differential Revision: D113319596