Skip to content

Improve error message for shape promotion on lowering. - #9486

Merged
ysiraichi merged 5 commits into
masterfrom
ysiraichi/shape-promotion-error-handling
Jul 17, 2025
Merged

Improve error message for shape promotion on lowering.#9486
ysiraichi merged 5 commits into
masterfrom
ysiraichi/shape-promotion-error-handling

Conversation

@ysiraichi

@ysiraichi ysiraichi commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

This PR improves error messages for shape promotion during XLA operation lowering and refactors relevant call sites to use GetValueOrThrow().

Key Changes:

  • Improved Shape Promotion Error Messages: The error message in XlaHelpers::GetPromotedShape() function for promoting shapes now provide more specific shape information, detailing what's invalid.
  • Using Status for shape promotion error handling: The function XlaHelpers::GetPromotedShape() now returns a StatusOr<Shape> data type for better error handling.
  • GetValueOrThrow() Adaptation: Call sites have been updated to use GetValueOrThrow() for more consistent error handling.

@ysiraichi ysiraichi changed the title Improve error message for shape promotion. Improve error message for shape promotion on lowering. Jul 16, 2025
@ysiraichi
ysiraichi marked this pull request as ready for review July 16, 2025 19:20

@zhanyong-wan zhanyong-wan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks!

Comment thread torch_xla/csrc/helpers.cpp

@zhanyong-wan zhanyong-wan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice!

@ysiraichi
ysiraichi merged commit 2c556e7 into master Jul 17, 2025
23 of 24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants