-
Notifications
You must be signed in to change notification settings - Fork 26.3k
[AOTI] Add standalone version of TORCH_CHECK #136873
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
Conversation
Summary: Use TORCH_CHECK_STD_ERROR which throws std::runtime_error, instead of using TORCH_CHECK which throws c10::Error, to cut dependency on libtorch. Specifically, Inductor CPU backend may generate cpp code that calls ATen vectorization ops and we need to make sure those ops don't call TORCH_CHECK. [ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/136873
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit db42a23 with merge base d1b87e2 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
Summary: Use TORCH_CHECK_STD_ERROR which throws std::runtime_error, instead of using TORCH_CHECK which throws c10::Error, to cut dependency on libtorch. Specifically, Inductor CPU backend may generate cpp code that calls ATen vectorization ops and we need to make sure those ops don't call TORCH_CHECK. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Summary: Use TORCH_CHECK_STD_ERROR which throws std::runtime_error, instead of using TORCH_CHECK which throws c10::Error, to cut dependency on libtorch. Specifically, Inductor CPU backend may generate cpp code that calls ATen vectorization ops and we need to make sure those ops don't call TORCH_CHECK. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Summary: Use TORCH_CHECK_STD_ERROR which throws std::runtime_error, instead of using TORCH_CHECK which throws c10::Error, to cut dependency on libtorch. Specifically, Inductor CPU backend may generate cpp code that calls ATen vectorization ops and we need to make sure those ops don't call TORCH_CHECK. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
albanD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a bit surprised by this change. c10::Error gives a lot of niceties like stack traces tracking, internal logging, TORCH_SHOW_CPP_STACKTRACES, etc
Also this is going to change the error we give to the python users?
I think we have to give up some properties if we want to make Vectorized ABI-compatible. The first attempt I made was to make c10::Error header-only, but it is not easy with something like Lines 61 to 63 in 2b329d3
|
|
Making this particular call go through the capi shim should be relatively simple though given the types involved right? |
If we give up on supporting varargs for this one, then yes. |
|
Ho we were actually chatting about this one with Jane earlier, wouldn't we be able to do the conversion vararg -> string in a header-only c++ layer and make the raw c api take a single raw string? |
|
AOTI_TORCH_CHECK already does that. I could use that for now, but there will still be a need to make these utility Vectorized implementation self-contained, i.e. libtorch independent. What about if I define |
Summary: Use TORCH_CHECK_STD_ERROR which throws std::runtime_error, instead of using TORCH_CHECK which throws c10::Error, to cut dependency on libtorch. Specifically, Inductor CPU backend may generate cpp code that calls ATen vectorization ops and we need to make sure those ops don't call TORCH_CHECK. cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 [ghstack-poisoned]
Summary: In the standalone mode, TORCH_CHECK throws std::runtime_error, instead of c10::Error. The goal is to cut dependency on libtorch. Specifically, AOTI generates CPU code which may call ATen vectorization ops and we need to make sure those ops are self-contained. [ghstack-poisoned]
Summary: In the standalone mode, TORCH_CHECK throws std::runtime_error, instead of c10::Error. The goal is to cut dependency on libtorch. Specifically, AOTI generates CPU code which may call ATen vectorization ops and we need to make sure those ops are self-contained. ghstack-source-id: 5707c8a Pull Request resolved: #136873
albanD
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds ok as a temporary unblock, let's discuss offline for broader plan and how to ensure this is preserved.
|
@desertfire has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: In the standalone mode, TORCH_CHECK throws std::runtime_error, instead of c10::Error. The goal is to cut dependency on libtorch. Specifically, AOTI generates CPU code which may call ATen vectorization ops and we need to make sure those ops are self-contained. Differential Revision: [D63911928](https://our.internmc.facebook.com/intern/diff/D63911928) cc jgong5 mingfeima XiaobingSuper sanchitintel ashokei jingxu10 voznesenskym penguinwu EikanWang Guobing-Chen zhuhaozhe blzheng wenzhe-nrv jiayisunx ipiszy yf225 chenyang78 kadeng muchulee8 ColinPeppler amjames chauhang [ghstack-poisoned]
Summary: In the standalone mode, TORCH_CHECK throws std::runtime_error, instead of c10::Error. The goal is to cut dependency on libtorch. Specifically, AOTI generates CPU code which may call ATen vectorization ops and we need to make sure those ops are self-contained. ghstack-source-id: 91649dd Pull Request resolved: #136873
|
@desertfire has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
@pytorchbot merge -f 'Landed internally' (Initiating merge automatically since Phabricator Diff has merged, using force because this PR might not pass merge_rules.json but landed internally) |
Merge startedYour change will be merged immediately since you used the force (-f) flag, bypassing any CI checks (ETA: 1-5 minutes). Please use Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary: In the standalone mode, TORCH_CHECK throws std::runtime_error, instead of c10::Error. The goal is to cut dependency on libtorch. Specifically, AOTI generates CPU code which may call ATen vectorization ops and we need to make sure those ops are self-contained. ghstack-source-id: 6dab1f7 Pull Request resolved: pytorch/pytorch#136873
Stack from ghstack (oldest at bottom):
Summary: In the standalone mode, TORCH_CHECK throws std::runtime_error, instead of c10::Error. The goal is to cut dependency on libtorch. Specifically, AOTI generates CPU code which may call ATen vectorization ops and we need to make sure those ops are self-contained.
Differential Revision: D63911928
cc @jgong5 @mingfeima @XiaobingSuper @sanchitintel @ashokei @jingxu10 @voznesenskym @penguinwu @EikanWang @Guobing-Chen @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @yf225 @chenyang78 @kadeng @muchulee8 @ColinPeppler @amjames @chauhang