Skip to content

[ExecuTorch][WebGPU] Add view_copy op (aten.view_copy.default)#20360

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

[ExecuTorch][WebGPU] Add view_copy op (aten.view_copy.default)#20360
JulianCloudNTH wants to merge 1 commit into
gh/JulianCloudNTH/35/basefrom
gh/JulianCloudNTH/35/head

Conversation

@JulianCloudNTH

@JulianCloudNTH JulianCloudNTH commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Adds aten.view_copy.default to the WebGPU delegate. A contiguous reshape on a dense row-major buffer backend is a flat copy output[i] = input[i], so the op is a single 1D-dispatch copy kernel.

Composition (single compute dispatch):

  • runtime/ops/view_copy/view_copy.h — declares add_flat_copy(graph, in_id, out_id): fail-loud guards (both tensors, fp32, numel-preserving) + the view_copy.wgsl dispatch over compute_1d_workgroup_count(num_elements) with override wg_size; mirrors Vulkan add_view_copy_node.
  • runtime/ops/view_copy/ViewCopy.cpp — reads args = [self, size, out], ignores the AOT-fixed size value-id (output shape comes from out_tensor.dims), calls add_flat_copy.
  • runtime/ops/view_copy/view_copy.wgsl — guards idx >= num_elements, writes output[idx] = input[idx].
  • add_flat_copy is factored into the header so the stacked squeeze/unsqueeze ops reuse it without a new kernel.

Differential Revision: D108793164

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jun 17, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 1 New Failure, 1 Cancelled Job, 1 Unrelated Failure

As of commit 1175a70 with merge base eb7473b (image):

NEW FAILURE - The following job has failed:

CANCELLED JOB - The following job was cancelled. Please retry:

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

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