Improve error message of functions related to GetXlaTensor().#9520
Merged
Improve error message of functions related to GetXlaTensor().#9520
GetXlaTensor().#9520Conversation
c47cb27 to
d51f82a
Compare
zhanyong-wan
reviewed
Aug 4, 2025
Collaborator
Author
|
Besides the changes requested in the review, other relevant changes are:
|
ghpvnist
reviewed
Aug 5, 2025
ghpvnist
approved these changes
Aug 5, 2025
Collaborator
ghpvnist
left a comment
There was a problem hiding this comment.
LGTM pending @zhanyong-wan's approval.
zhanyong-wan
approved these changes
Aug 6, 2025
99ed2b8 to
ba1f008
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR refactors functions related to
GetXlaTensor(), improving error message, and propagating status. These changes should make errors more actionable from users perspective. Additionally, this PR also allows Python API bound functions to returns status values.Key Changes:
GetValueOrThrow(Status)overload, so that we can callGetValueOrThrowfor bothStatusansStatusOr<T>return valuesscope.def(..., [](...) -> absl::Status { ... })GetValueOrThrow()in the resulting status, returning voidGetXlaTensorImpl(): assumes less context, with a more detailed error messageGetXlaTensor(): more meaningful, and higher level messageGetXlaTensors(): more information, such as the index of the non-XLA tensorReplaceXlaTensor(): rewordedGetInputXlaTensor()for returning errors with more contextGetXlaTensor(), specifically for inputs that directly come from the user_xla_dot_general: callingGetInputXlaTensor()on its tensor inputs_get_graph_hash: callingGetXlaTensors()instead of an explicit loop with the same semanticUpdate (Aug 4):
BuildStatusErrorMessage(const absl::Status&), in order to get the error message, and status propagation trace when crashing on aABSL_CHECK()call._get_graph_hash, since it crashes, nowReplaceTensorfunctions