Skip to content

Re-inplace slice_copy with slice #10917

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
metascroy opened this issue May 15, 2025 · 1 comment
Open

Re-inplace slice_copy with slice #10917

metascroy opened this issue May 15, 2025 · 1 comment
Labels
good first issue Good for newcomers

Comments

@metascroy
Copy link
Contributor

🚀 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

@JacobSzwejbka
Copy link
Contributor

Ideally this pass works for other dim orders then the default but that can be a follow up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
Development

No branches or pull requests

2 participants