Skip to content

[ExecuTorch][WebGPU] Add aten.index.Tensor (1D-self gather)#20461

Closed
ghost wants to merge 1 commit into
gh/JulianCloudNTH/56/basefrom
gh/JulianCloudNTH/56/head
Closed

[ExecuTorch][WebGPU] Add aten.index.Tensor (1D-self gather)#20461
ghost wants to merge 1 commit into
gh/JulianCloudNTH/56/basefrom
gh/JulianCloudNTH/56/head

Conversation

@ghost

@ghost ghost commented Jun 23, 2026

Copy link
Copy Markdown

Stack from ghstack (oldest at bottom):

  • (to be filled)

Adds the WebGPU delegate handler for aten.index.Tensor, the 1D-self advanced-index
gather out[i] = self[index[i]] (output shape == index shape). This is the form the
VulkanPartitioner delegates -- it requires a 1D self and exactly one non-None index
(op_registry.py); 2D mask/freqs gathers stay on CPU. It mirrors the Vulkan delegate's
index_tensor op (IndexTensor.cpp + index_tensor_buffer.glsl) as a single compute
dispatch over the output elements, each reading the int32 index and gathering the
corresponding fp32 self element.

The op is composed as:

  • index.wgsl: one workgroup-strided pass, out[i] = self[u32(index[i])], guarded by a
    numel bound; buffer-only, fp32 self/out, int32 index, 1D dispatch via the shared
    WebGPUUtils helpers (clamp workgroup size + 1D count).
  • Index.cpp: validates the args (self/out tensors; indices ValueList with exactly one
    index tensor; fp32 self/out; int32 index; out numel == index numel), failing loud on
    any violation, then records the dispatch. row_width is dropped (always 1 for 1D self).

Differential Revision: D109478967

[ghstack-poisoned]
@ghost
ghost requested review from kirklandsign and larryliu0820 as code owners June 23, 2026 20:34
@pytorch-bot

pytorch-bot Bot commented Jun 23, 2026

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/20461

Note: Links to docs will display an error until the docs builds have been completed.

❌ 7 New Failures, 1 Pending, 1 Unrelated Failure

As of commit 80e6fb0 with merge base 1b726b2 (image):

NEW FAILURES - The following jobs have failed:

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.

@github-actions

Copy link
Copy Markdown

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@ghost ghost closed this Jun 29, 2026
@ghost
ghost had a problem deploying to cherry-pick-bot June 29, 2026 17:20 — with GitHub Actions Failure
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants