Skip to content

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

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

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

Conversation

@JulianCloudNTH

Copy link
Copy Markdown
Contributor

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]
@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.

❗ 1 Active SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

❌ 6 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.

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.

1 participant