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

[dynamo] Allow asserts to fail #126661

Closed
wants to merge 2 commits into from

Conversation

peterbell10
Copy link
Collaborator

@peterbell10 peterbell10 commented May 20, 2024

Stack from ghstack (oldest at bottom):

Currently if an assertion is statically known to be false, dynamo converts it to
_assert_async which inductor currently ignores. Instead this graph breaks to
raise the original assertion.

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

Currently if an assertion is statically known to be false, dynamo converts it to
`_assert_async` which inductor currently ignores. Instead this graph breaks to
raise the original assertion.

[ghstack-poisoned]
Copy link

pytorch-bot bot commented May 20, 2024

🔗 Helpful Links

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

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

✅ No Failures

As of commit 5b077ba with merge base 5fb11cd (image):
💚 Looks good so far! There are no failures yet. 💚

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

peterbell10 added a commit that referenced this pull request May 20, 2024
Currently if an assertion is statically known to be false, dynamo converts it to
`_assert_async` which inductor currently ignores. Instead this graph breaks to
raise the original assertion.

ghstack-source-id: f20717d8fa7be80257a614231e39371b92d2b20d
Pull Request resolved: #126661
Currently if an assertion is statically known to be false, dynamo converts it to
`_assert_async` which inductor currently ignores. Instead this graph breaks to
raise the original assertion.

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

[ghstack-poisoned]
peterbell10 added a commit that referenced this pull request May 20, 2024
Currently if an assertion is statically known to be false, dynamo converts it to
`_assert_async` which inductor currently ignores. Instead this graph breaks to
raise the original assertion.

ghstack-source-id: 2bcbd9126a18e2078471f680d5e4b5a7eb2e90a7
Pull Request resolved: #126661
@peterbell10 peterbell10 changed the title [dynamo] Fix failing asserts [dynamo] Allow asserts to fail May 20, 2024
@peterbell10 peterbell10 marked this pull request as ready for review May 20, 2024 18:21
@peterbell10 peterbell10 requested a review from lezcano May 20, 2024 18:21
Copy link
Collaborator

@lezcano lezcano left a comment

Choose a reason for hiding this comment

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

I don't like this one. I think it should be:

  • If we can prove that it's true or false, then act accordingly.
  • Otherwise, process it as runtime assert

This way we can use asserts to add facts to our knowledge base (shape env).

cc @ezyang

@peterbell10
Copy link
Collaborator Author

peterbell10 commented May 20, 2024

If we can prove that it's true or false, then act accordingly.

That's what this does. If we statically know it's false then we graph break and let python raise the exception.

Copy link
Contributor

@ezyang ezyang left a comment

Choose a reason for hiding this comment

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

Yeah, this LGTM, thanks @peterbell10

@ezyang
Copy link
Contributor

ezyang commented May 21, 2024

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label May 21, 2024
@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@lezcano
Copy link
Collaborator

lezcano commented May 21, 2024

uh, sorry, I had misread the code. I thought this was also handling the expression being equal to None.

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

Successfully merging this pull request may close these issues.

None yet

5 participants