Skip to content
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

Add stride operation primitive #135

Closed
riccardofelluga opened this issue Apr 5, 2024 · 2 comments
Closed

Add stride operation primitive #135

riccardofelluga opened this issue Apr 5, 2024 · 2 comments
Labels
enhancement New feature or request memory format

Comments

@riccardofelluga
Copy link
Collaborator

riccardofelluga commented Apr 5, 2024

🚀 Feature

I would like to have Thunder manage stride information to allow for tensor manipulations.

In particular I think the following points need to be discussed:

  • Where does the stride information go? Should it be part of TensorProxy?
  • What can a stride manipulation primitive look like? Are there any particular things we need to be careful about?

Motivation

This will enable us to add new operators that reshape the tensor using the stride like torch.as_strided or torch.Tensor.unfold.

@riccardofelluga riccardofelluga added enhancement New feature or request memory format labels Apr 5, 2024
@riccardofelluga riccardofelluga changed the title Add stride manipulation primitive Add stride operation primitive Apr 5, 2024
@mruberry
Copy link
Collaborator

mruberry commented Apr 8, 2024

Hey @riccardofelluga!

fyi @jjsjann123, too

We actually have a stride order primitive today:

STRIDE_ORDER = auto()

We don't have plans to implement support for setting exact strides, just to reorder them (like the stride order primitive does). What were you thinking of?

@riccardofelluga
Copy link
Collaborator Author

Hey! So what I was thinking was more about setting exact strides.

However, @IvanYashchuk pointed out to me that this discussion has been held once before. That discussion led to the following conclusion:

[...] we did identify that having a stride semantics in the graph is useful, but it's very hard to do it right and efficiently, without putting unnecessary constraints on backends.

Additionally, there is a comment on jax that I think summarizes enough the possible complexity of having such a feature.

In conclusion, I think it's fair to say that unless there is a stronger need for it, it's better to put this idea aside for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request memory format
Projects
None yet
Development

No branches or pull requests

2 participants