Skip to content

Re-inplace slice_copy with slice #10917

Description

@metascroy

🚀 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions