[ExecuTorch][WebGPU] Port index_select#21171
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/21171
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: ❌ 48 New FailuresAs of commit e743cc5 with merge base 266e0dc ( NEW FAILURES - The following jobs have failed:
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.index_select.defaultas a gather along a dim, mirroring the landedflip/splitindex-transform (dual-TensorMeta, 2D-fold dispatch) + the landedindex/Index.cppint-index binding. index_select is pure data movement, so it remaps the dim coord through an int index and copies — no fp compute.Key changes:
runtime/ops/index_select/{IndexSelect.cpp, index_select.wgsl}(+ generatedindex_select_wgsl.h) — per out flat idx: unravel viaout_meta.strides,in_coord = out_coordwith the dim coord remapped byindex[out_coord[dim]], ravel viain_meta.strides,output[out] = input[in]; the index tensor is bound asarray<i32>(the int32downcast_64_bitof the int64 index, same asIndex.cpp);Params { info: vec4<u32> }carriesdim. Registeredaten.index_select.default.CMakeLists.txt—runtime/ops/index_select/IndexSelect.cppinWEBGPU_SRCS.Buffer re-derivation of the gather (Vulkan
IndexSelect.cppis texture/channel-packed only —op_registry.pytags itCHANNELS_PACKED_TEXTURE; this backend is buffer-only, so the NCHW index math is derived and CPU-de-risked, cf.split.wgsl). Index-value bounds are trusted/unclamped, matching Vulkanindex_select.glsl; a negative index is a memory-safe WGSL OOB read (no trap), same safety class as Vulkan's clampedtexelFetch. No int dtype-guard on self/out (bit-preserving);nbytesguards reject non-fp32 self/out and a non-int32 index.Differential Revision: D112257660