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

[Relax] Remove segfault in R.call_tir_inplace validation #17242

Conversation

Lunderberg
Copy link
Contributor

Prior to this commit, the error message produced when validating R.call_tir_inplace included the shape of the argument that will be mutated in-place. This correctly caught and raised an error when the argument is a tensor with known shape that is incompatible with the output tensor's shape. However, this same error message could be also be reached if the input does not have TensorStructInfo at all, which would trigger a segfault.

This commit updates the validation to print the argument's StructInfo directly, rather than a field from the struct info. This correctly raises an error for the cases where the argument is not a tensor, or is a tensor with unknown dimensionality, while still printing the explicit shape of the mismatched tensor when avalable.

Prior to this commit, the error message produced when validating
`R.call_tir_inplace` included the shape of the argument that will be
mutated in-place.  This correctly caught and raised an error when the argument is a
tensor with known shape that is incompatible with the output tensor's
shape.  However, this same error message could be also be reached if
the input does not have `TensorStructInfo` at all, which would trigger
a segfault.

This commit updates the validation to print the argument's
`StructInfo` directly, rather than a field from the struct info.  This
correctly raises an error for the cases where the argument is not a
tensor, or is a tensor with unknown dimensionality, while still
printing the explicit shape of the mismatched tensor when avalable.
@tqchen tqchen merged commit 591cf1e into apache:main Aug 6, 2024
19 checks passed
@Lunderberg Lunderberg deleted the relax_avoid_exception_in_call_tir_inplace_normalization branch August 6, 2024 14:11
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