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

Make getTypeForScalarType safer by returning FailureOr<Type> #1814

Merged
merged 1 commit into from
Jan 20, 2023

Conversation

ramiro050
Copy link
Collaborator

One of the potential values for a torch_upstream::ScalarType is Undefined. This means that conversion of a ScalarType to another type is a computation that can fail. To enforce handling of the failure case, this commit makes the two helper functions that convert ScalarTypes into other types return failure() when the ScalarType is Undefined.

One of the potential values for a `torch_upstream::ScalarType` is
`Undefined`. This means that conversion of a `ScalarType` to another
type is a computation that can fail. To enforce handling of the
failure case, this commit makes the two helper functions that convert
`ScalarType`s into other types return `failure()` when the
`ScalarType` is `Undefined`.
@ramiro050 ramiro050 force-pushed the fix-refine-types-crash branch from 815bd29 to c9f86fe Compare January 19, 2023 22:10
@mgehre-amd
Copy link
Contributor

Looks great!

@ramiro050 ramiro050 merged commit d849cba into llvm:main Jan 20, 2023
@ramiro050 ramiro050 deleted the fix-refine-types-crash branch January 20, 2023 18:40
gpetters94 pushed a commit to gpetters94/mlir-npcomp that referenced this pull request May 10, 2023
…m#1814)

One of the potential values for a `torch_upstream::ScalarType` is
`Undefined`. This means that conversion of a `ScalarType` to another
type is a computation that can fail. To enforce handling of the
failure case, this commit makes the two helper functions that convert
`ScalarType`s into other types return `failure()` when the
`ScalarType` is `Undefined`.
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