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

fix soundness bug with unsupported constraints #102897

Closed

Conversation

avikchaudhuri
Copy link
Contributor

@avikchaudhuri avikchaudhuri commented Jun 3, 2023

Stack from ghstack (oldest at bottom):

We do not raise constraint violations for complex binary conditions, such as conditions involving %. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes.

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: D46415786

cc @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @ipiszy @aakhundov

@pytorch-bot
Copy link

pytorch-bot bot commented Jun 3, 2023

🔗 Helpful Links

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

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

⏳ No Failures, 6 Pending

As of commit d8a72c8:
💚 Looks good so far! There are no failures yet. 💚

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

@pytorch-bot pytorch-bot bot added the release notes: fx release notes category label Jun 3, 2023
avikchaudhuri added a commit that referenced this pull request Jun 3, 2023
Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

ghstack-source-id: 191106011
Pull Request resolved: #102897
Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 3, 2023
Pull Request resolved: #102897


ghstack-source-id: 191107045

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 3, 2023
Pull Request resolved: #102897


ghstack-source-id: 191115588

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 3, 2023
Pull Request resolved: #102897


ghstack-source-id: 191117531

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 3, 2023
Pull Request resolved: #102897


ghstack-source-id: 191117957

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 5, 2023
Pull Request resolved: #102897


ghstack-source-id: 191208582

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
if s not in self._substitutions
}

def solve(self, disable_congruences=True):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If and when we support specifying % constraints, we can enable this flag.

@avikchaudhuri
Copy link
Contributor Author

Failing tests are caused by some mismatch in error format in #102666, not sure why these are not picked up by CI.

We do not raise constraint violations for complex binary conditions, such as conditions involving `%`. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes. 

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 5, 2023
Pull Request resolved: #102897


ghstack-source-id: 191222433

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
),
):
torch._export.export(m, (a,), constraints=constraints)
em = torch._export.export(m, (a,)).add_runtime_assertions()
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to rebase.

Copy link
Contributor

Choose a reason for hiding this comment

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

I recently landed a change that makes this private method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'll wait for https://www.internalfb.com/diff/D46471787 to land internally before rebasing.

We do not raise constraint violations for complex binary conditions, such as conditions involving `%`. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes. 

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 7, 2023
Pull Request resolved: #102897


ghstack-source-id: 191432844

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
We do not raise constraint violations for complex binary conditions, such as conditions involving `%`. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes. 

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 7, 2023
Pull Request resolved: #102897


ghstack-source-id: 191471891

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
We do not raise constraint violations for complex binary conditions, such as conditions involving `%`. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes. 

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 8, 2023
Pull Request resolved: #102897


ghstack-source-id: 191611523

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
We do not raise constraint violations for complex binary conditions, such as conditions involving `%`. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes. 

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 9, 2023
Pull Request resolved: #102897


ghstack-source-id: 191705573

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
@avikchaudhuri
Copy link
Contributor Author

@pytorchbot merge -f "spurious CI failure, checked that internal failures are also infra issues"

@pytorchmergebot
Copy link
Collaborator

Merge started

Your change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes).

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

@pytorchmergebot
Copy link
Collaborator

Merge failed

Reason: Command git -C /home/runner/work/pytorch/pytorch cherry-pick -x ba850058f1ddd5b5f89c17ed385e09b0f7f5d862 returned non-zero exit code 1

Auto-merging test/export/test_export.py
CONFLICT (content): Merge conflict in test/export/test_export.py
Auto-merging torch/_dynamo/eval_frame.py
error: could not apply ba850058f1d... fix soundness bug with unsupported constraints
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
Details for Dev Infra team Raised by workflow job

We do not raise constraint violations for complex binary conditions, such as conditions involving `%`. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes. 

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy aakhundov

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 9, 2023
Pull Request resolved: #102897


ghstack-source-id: 191740160

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
We do not raise constraint violations for complex binary conditions, such as conditions involving `%`. Moreover, while these constraints are discovered by our solver, the solver does not inject new constraint violations. This can result in cases where export passes, appropriate assertions are not added, and we get runtime crashes. 

Now, when the solver discovers constraints that are too complex, we force-specialize the involved dimensions and raise a constraint violation when such dimensions are marked dynamic. This forces the user to remove the dynamic marking, and causes the appropriate specialization assertions to be added.

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)

cc voznesenskym penguinwu anijain2305 EikanWang jgong5 Guobing-Chen XiaobingSuper zhuhaozhe blzheng Xia-Weiwen wenzhe-nrv jiayisunx ipiszy aakhundov

[ghstack-poisoned]
avikchaudhuri added a commit that referenced this pull request Jun 9, 2023
Pull Request resolved: #102897


ghstack-source-id: 191740589

Differential Revision: [D46415786](https://our.internmc.facebook.com/intern/diff/D46415786/)
@avikchaudhuri
Copy link
Contributor Author

@pytorchbot merge

@pytorch-bot pytorch-bot bot added the ciflow/trunk Trigger trunk jobs on your pull request label Jun 9, 2023
@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

@facebook-github-bot facebook-github-bot deleted the gh/avikchaudhuri/34/head branch June 13, 2023 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/inductor ciflow/trunk Trigger trunk jobs on your pull request Merged module: dynamo release notes: fx release notes category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants