[ExecuTorch][WebGPU] Port repeat#21168
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21168
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: ✅ You can merge normally! (1 Unrelated Failure)As of commit fd8595d with merge base 266e0dc ( 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):
Ports
aten.repeat.defaultas a per-element tiling gather, mirroring the landedpermute/flipindex-transform (dual-TensorMeta, 2D-fold dispatch). repeat is pure data movement, so it maps each output element to its source via a per-dim modulo and copies — no fp compute.Key changes:
runtime/ops/repeat/{Repeat.cpp, repeat.wgsl}(+ generatedrepeat_wgsl.h) — per out flat idx: unravel viaout_meta.strides,in_coord = out_coord % in_meta.sizes[in_d], ravel viain_meta.strides,output[out] = input[in]; registeredaten.repeat.default.CMakeLists.txt—runtime/ops/repeat/Repeat.cppinWEBGPU_SRCS.Mirrors Vulkan
glsl/repeat_buffer.glsl(in_tidx[d] = out_tidx[d] % size_at(in_meta, d)). Vulkan's innermost-firstBufferMetadataauto-aligns a shorter input; WebGPU's NCHWTensorMetamakes the right-alignment explicit viaoffset = out_ndim - in_ndim(leadingd < offsetdims are pure prepends, contributing 0). Norepeats-arg read needed: the repeated out dims are baked in by export, so the tiling is recoverable from shapes alone. No int dtype-guard (bit-preserving movement, likeflip); thenbytes != numel*4guard rejects int64/fp16.Differential Revision: D112257679