Skip to content

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

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

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

Conversation

@JulianCloudNTH

@JulianCloudNTH JulianCloudNTH commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

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/20464

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:

❌ 5 New Failures, 2 Pending, 4 Unrelated Failures

As of commit 8ca983e with merge base 1b726b2 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following job failed but was likely due to flakiness present on trunk:

BROKEN TRUNK - The following jobs failed but was 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 was referenced Jun 23, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 23, 2026
@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