8000 [DRAFT][Reshape] Guard-free reshape for contiguous tensors to avoid data dependent errors. by laithsakka · Pull Request #148742 · pytorch/pytorch · GitHub
[go: up one dir, main page]

Skip to content

[DRAFT][Reshape] Guard-free reshape for contiguous tensors to avoid data dependent errors. #148742

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

Draft
wants to merge 9 commits into
base: gh/laithsakka/114/base
Choose a base branch
from

Conversation

laithsakka
Copy link
Contributor
@laithsakka laithsakka commented Mar 7, 2025

Stack from ghstack (oldest at bottom):

Main reason for refactor is to avoid data dependent error that the default path have
this is because this new path have no checks on sizes.

Does this deviate from previous behaviors/or from torch eager? specially when it comes to strides?
I need to dig deep on this, I do not have a clear answer. There was in situation where this used to diverge
from previous behavior when we reshape the input to itself but i addressed that.

In general we have three choices here:

  1. use the new logic only for unbacked.
  2. use it for all compile
  3. use it for eager and compile

I do not want to spend time fixing the failing tests if we are going to go with (1) or if the idea is not accepted
thats why i would like to have this discussed first. the failures does seems not risky (change expected string or runtime assert ..etc)

cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @chenyang78 @kadeng @chauhang @amjames

Copy link
pytorch-bot bot commented Mar 7, 2025

🔗 Helpful Links

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

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

❌ 10 New Failures, 4 Unrelated Failures

As of commit 8bb976d with merge base d363913 (image):

NEW FAILURES - The following jobs have failed:

FLAKY - The following jobs failed but were likely due to flakiness present on trunk:

UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:

This comment was automatically generated by Dr. CI and updates every 15 minutes.

laithsakka added a commit that referenced this pull request Mar 7, 2025
ghstack-source-id: 4320acb
Pull Request resolved: #148742
Copy link
Contributor
github-actions bot commented Mar 7, 2025

This PR needs a release notes: label

If your changes are user facing and intended to be a part of release notes, please use a label starting with release notes:.

If not, please add the topic: not user facing label.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "topic: not user facing"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@laithsakka laithsakka changed the title guard reshape for contiguous tesnors guard-free reshape for contiguous tensors Mar 7, 2025
@laithsakka laithsakka changed the title guard-free reshape for contiguous tensors Guard-free reshape for contiguous tensors Mar 7, 2025
laithsakka added a commit that referenced this pull request Mar 7, 2025
ghstack-source-id: 26372e1
Pull Request resolved: #148742
@laithsakka laithsakka marked this pull request as draft March 7, 2025 06:05
Main reason for refactor is to avoid data dependent error that the default path have.
this is because this new path have no checks on sizes

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Mar 7, 2025
ghstack-source-id: a02a03d
Pull Request resolved: #148742
Main reason for refactor is to avoid data dependent error that the default path have.
this is because this new path have no checks on sizes

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Mar 7, 2025
ghstack-source-id: 3855846
Pull Request resolved: #148742
Main reason for refactor is to avoid data dependent error that the default path have.
this is because this new path have no checks on sizes

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Mar 7, 2025
ghstack-source-id: cbaabe1
Pull Request resolved: #148742
return prims.view_of(a)

strides = [1]
for x in reversed(shape[1:]):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be shape[:-1]?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

haha maybe i am new ish to python no fancy slicing in c++.
I will try it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean why not
[1:][::-1]
I want to remove first element the reverse

Main reason for refactor is to avoid data dependent error that the default path have.
this is because this new path have no checks on sizes

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Mar 7, 2025
ghstack-source-id: d09c8a2
Pull Request resolved: #148742
@laithsakka laithsakka requested a review from ezyang March 7, 2025 19:58
@laithsakka laithsakka added the keep-going Don't stop on first failure, keep running tests until the end label Mar 8, 2025
Main reason for refactor is to avoid data dependent error that the default path have
this is because this new path have no checks on sizes.

Does this deviate from previous behaviors/or from torch eager? specially when it comes to strides?
I need to dig deep on this, I do not have a clear answer. There was in situation where this used to diverge
from previous behavior when we reshape the input to itself but i addressed that. 


In general we have three choices here:
1. use the new logic only for unbacked. 
2. use it for all compile
3. use it for eager and compile

I do not want to spend time fixing the failing tests if we are going to go with (1) or if the idea is not accepted 
thats why i would like to have this discussed first. the failures does seems not risky (change expected string or runtime assert ..etc)

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
laithsakka added a commit that referenced this pull request Mar 8, 2025
ghstack-source-id: 3e1561c
Pull Request resolved: #148742
@laithsakka laithsakka changed the title Guard-free reshape for contiguous tensors [DRAFT] Guard-free reshape for contiguous tensors to avoid data dependent errors. Mar 8, 2025
@laithsakka laithsakka changed the title [DRAFT] Guard-free reshape for contiguous tensors to avoid data dependent errors. [DRAFT][Reshape] Guard-free reshape for contiguous tensors to avoid data dependent errors. Mar 8, 2025
… to avoid data dependent errors."


Main reason for refactor is to avoid data dependent error that the default path have
this is because this new path have no checks on sizes.

Does this deviate from previous behaviors/or from torch eager? specially when it comes to strides?
I need to dig deep on this, I do not have a clear answer. There was in situation where this used to diverge
from previous behavior when we reshape the input to itself but i addressed that. 


In general we have three choices here:
1. use the new logic only for unbacked. 
2. use it for all compile
3. use it for eager and compile

I do not want to spend time fixing the failing tests if we are going to go with (1) or if the idea is not accepted 
thats why i would like to have this discussed first. the failures does seems not risky (change expected string or runtime assert ..etc)

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
… to avoid data dependent errors."


Main reason for refactor is to avoid data dependent error that the default path have
this is because this new path have no checks on sizes.

Does this deviate from previous behaviors/or from torch eager? specially when it comes to strides?
I need to dig deep on this, I do not have a clear answer. There was in situation where this used to diverge
from previous behavior when we reshape the input to itself but i addressed that. 


In general we have three choices here:
1. use the new logic only for unbacked. 
2. use it for all compile
3. use it for eager and compile

I do not want to spend time fixing the failing tests if we are going to go with (1) or if the idea is not accepted 
thats why i would like to have this discussed first. the failures does seems not risky (change expected string or runtime assert ..etc)

cc voznesenskym penguinwu EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng wenzhe-nrv jiayisunx chenyang78 kadeng chauhang amjames

[ghstack-poisoned]
Divigroup-RAP pushed a commit to Divigroup-RAP/PYTORCH that referenced this pull request Apr 22, 2025
ghstack-source-id: e8baa07
Pull Request resolved: pytorch/pytorch#148742
Copy link
Contributor

Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as Stale.
Feel free to remove the Stale label if you feel this was a mistake.
If you are unable to remove the Stale label please contact a maintainer in order to do so.
If you want the bot to never mark this PR stale again, add the no-stale label.
Stale pull requests will automatically be closed after 30 days of inactivity.

@github-actions github-actions bot added the Stale label May 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor keep-going Don't stop on first failure, keep running tests until the end module: dynamo Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0