pytorch / pytorch/executorch

Re-inplace slice_copy with slice

Open
#10,917 7 comments 1 reaction 1 assignee View on GitHub

@iRAFEEK is already working on this.

Since Aug 3, 2026.

good first issue
Dominant language
Python
Stars
5k
Forks
1.2k
Avg merge
2d 10h
Merged PRs (30d)
581

Description

🚀 The feature, motivation and pitch

Before to_executorch, there are view_copy nodes in the graph. During to_executorch, we replace view_copy nodes with view nodes before memory planning: https://github.com/pytorch/executorch/blob/main/exir/program/_program.py#L757-L761

These get emitted to view ops here: https://github.com/pytorch/executorch/blob/main/exir/emit/_emitter.py#L944-L978

The view op is implemented here: https://github.com/pytorch/executorch/blob/main/kernels/prim_ops/et_view.cpp

We want to do the same for contiguous slices. If a graph has a contiguous slice, we want to replace it with a lightweight slice kernel, rather than a slice_copy kernel.

If interested in this task, please reach out to @metascroy. Happy to guide you through it :)

cc @JacobSzwejbka

Alternatives

No response

Additional context

No response

RFC (Optional)

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.