-
Notifications
You must be signed in to change notification settings - Fork 548
Suppress C++ stacktrace on XLA_CHECK*()
calls.
#9448
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
base: master
Are you sure you want to change the base?
Conversation
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.
Thanks!
ess << file_ << ":" << line_ << " : " << sink_str; | ||
ess << sink.str(); | ||
|
||
if (ShouldShowCppErrorContext()) { |
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.
Can we include the C++ stack trace when this is true?
// | ||
// More specifically, whether the `XLA_SHOW_CPP_ERROR_CONTEXT` environment | ||
// variable is set or not. | ||
bool ShouldShowCppErrorContext(); |
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.
Style: [[nodiscard]]
@@ -7,14 +7,14 @@ | |||
#include "tsl/platform/statusor.h" | |||
|
|||
#define XLA_ERROR() TF_ERROR_STREAM() |
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.
Document how these macros react to XLA_SHOW_CPP_ERROR_CONTEXT
?
ess << file_ << ":" << line_ << " : " << sink_str; | ||
ess << sink.str(); | ||
|
||
if (ShouldShowCppErrorContext()) { |
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.
Add tests to verify the new behavior?
This PR improves error messages in PyTorch/XLA by suppressing the display of C++ stack traces during XLA check failures, making them more user-friendly. Currently, when
XLA_CHECK*()
fails, the resulting error output includes a lengthy and verbose C++ stacktrace. While these can be useful for deep-dive debugging by developers, they often add noise for end-users.Key Changes:
XLA_CHECK*()
failuresXLA_SHOW_CPP_ERROR_CONTEXT=1
XlaCoordinator
to use status types. #9386Before:
After: