Skip to content

[ExecuTorch][WebGPU] slice_copy op test suite (cases.py op-test framework)#20395

Open
JulianCloudNTH wants to merge 2 commits into
gh/JulianCloudNTH/44/basefrom
gh/JulianCloudNTH/44/head
Open

[ExecuTorch][WebGPU] slice_copy op test suite (cases.py op-test framework)#20395
JulianCloudNTH wants to merge 2 commits into
gh/JulianCloudNTH/44/basefrom
gh/JulianCloudNTH/44/head

Conversation

@JulianCloudNTH

@JulianCloudNTH JulianCloudNTH commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Stack from ghstack (oldest at bottom):

Registers aten.slice_copy.Tensor in the cases.py op-test framework: a _slice_suite of 4 configs (leading-dim slice [:,1:5], last-dim slice [...,1:3], step-2 [:,0:8:2], negative-end [:,1:-1]) that generate_op_tests exports via VulkanPartitioner and compares to a torch golden on Dawn. Also adds test/ops/slice/test_slice.py (SliceModule + CONFIGS + export-delegation/eager smoke test) and the aten.slice_copy.Tensor partitioner-allowlist entry in tester.py.
@exported-using-ghexport

Differential Revision: D108793151

Differential Revision: D108793151

[ghstack-poisoned]
@pytorch-bot

pytorch-bot Bot commented Jun 18, 2026

Copy link
Copy Markdown

🔗 Helpful Links

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

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

❌ 3 New Failures, 2 Unrelated Failures

As of commit 9a9f212 with merge base 0e65ba6 (image):

NEW FAILURES - The following jobs have failed:

BROKEN TRUNK - The following jobs 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.

@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 18, 2026
@JulianCloudNTH

Copy link
Copy Markdown
Contributor Author

@claude review

@claude

claude Bot commented Jun 18, 2026

Copy link
Copy Markdown

Claude finished @JulianCloudNTH's task in 46s —— View job


Code Review: slice_copy op test suite

  • Read PR diff against base
  • Compare against sibling op-test patterns (select, squeeze)
  • Review for correctness & consistency

This is a clean, well-scoped addition that follows the established WebGPU op-test conventions closely. test_slice.py mirrors test_select.py almost exactly, and the cases.py / tester.py hooks match the existing view_copy/select registrations. No blocking issues.

Observations

1. test_golden_matches_eager is a tautologybackends/webgpu/test/ops/slice/test_slice.py:71

torch.testing.assert_close(SliceModule(fn)(x), fn(x))

SliceModule.forward just calls self.fn(x), so this compares fn(x) against fn(x) and can never fail. It's effectively a no-op as a correctness check (the real eager-vs-backend comparison happens in generate_op_tests on Dawn). This is consistent with test_select.py:70, so it's a pre-existing pattern rather than a regression — flagging only so it's a conscious choice. The actual signal here is test_export_delegates; the golden check could arguably be dropped, but keeping it for symmetry with select is reasonable.

2. No _op_delegated fallback check (unlike squeeze)test_squeeze.py:56-73 additionally asserts the op was absorbed into the delegate rather than left as a CPU fallback node. slice/select/view_copy only check that a VulkanBackend delegate exists, which a single delegated node elsewhere in the graph would satisfy even if slice_copy itself fell back. Since these modules are single-op, the risk is low, but adding the _op_delegated(edge, "slice_copy") assertion would make test_export_delegates strictly verify what the PR claims. Optional, and again consistent with the select precedent.

3. Config coverage looks good. Leading-dim, last-dim, step-2, and negative-end cover the interesting slice_copy paths. The step2 case ([:, 0:8:2]) is a nice inclusion since strided slices are a common kernel edge case. One gap worth a thought: a negative-step slice (e.g. [:, ::-1]) — if the Vulkan kernel doesn't support it, it'd be good to know it gracefully falls back rather than mis-lowers, but that's a follow-up concern, not required here.

Nits

  • test_slice.py uses _export (returns to_executorch()) while test_squeeze.py uses _lower (returns the edge program, then calls .to_executorch() separately). The _export naming here matches select, so it's fine — just noting the two naming conventions coexist in this directory.
  • __init__.py is license-header-only, consistent with the other ops/*/__init__.py.

Verdict: LGTM. The two structural notes (tautological golden check, missing op-fallback assertion) are inherited from the select template, so they're fair to defer; if you'd like the suite to be stricter, point (2) is the highest-value addition.
· gh/JulianCloudNTH/44/head

[ghstack-poisoned]
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. meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant