Skip to content

Conversation

makslevental
Copy link
Collaborator

Fixes #751 where torch.bool is parsed as signless i1.

@makslevental makslevental requested a review from cathyzhyi April 13, 2022 15:55
Copy link
Contributor

@cathyzhyi cathyzhyi left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@@ -50,7 +50,7 @@ torch_upstream::ScalarType Torch::getScalarTypeForType(Type type) {
return torch_upstream::ScalarType::Long;
if (type.isSignedInteger(32))
return torch_upstream::ScalarType::Int;
if (type.isUnsignedInteger(1))
if (type.isUnsignedInteger(1) || type.isSignlessInteger(1))
Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, the type.isUnsignedInteger(1) can be removed as the dtype can't be si1

|-------------------|--------------------|
| torch.float16 | f16 |
| torch.bfloat16 | bf16 |
| torch.float32 | f32 |
| torch.float64 | f64 |
| torch.uint8 | ui8 |
| torch.int8 | si8 |
| torch.int16 | si16 |
| torch.int32 | si32 |
| torch.int64 | si64 |
| torch.bool | i1 |
| torch.qint8 | !torch.qint8 |
|-------------------|--------------------|

@cathyzhyi
Copy link
Contributor

btw, the new test need to be added to the list here

@cathyzhyi cathyzhyi self-requested a review April 13, 2022 17:11
@makslevental makslevental merged commit 24f9de7 into llvm:main Apr 13, 2022
@makslevental makslevental deleted the fix_signless_bool branch April 13, 2022 17:28
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.

torch.bool presents as unhandled signless i1
2 participants