-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[mlir][spirv] Handle vectors of integers of unsupported width #118663
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -292,13 +292,19 @@ convertScalarType(const spirv::TargetEnv &targetEnv, | |
| } | ||
|
|
||
| /// Converts a sub-byte integer `type` to i32 regardless of target environment. | ||
| /// Returns a nullptr for unsupported integer types, including non sub-byte | ||
| /// types. | ||
| /// | ||
| /// Note that we don't recognize sub-byte types in `spirv::ScalarType` and use | ||
| /// the above given that these sub-byte types are not supported at all in | ||
| /// SPIR-V; there are no compute/storage capability for them like other | ||
| /// supported integer types. | ||
| static Type convertSubByteIntegerType(const SPIRVConversionOptions &options, | ||
| IntegerType type) { | ||
| if (type.getWidth() > 8) { | ||
| LLVM_DEBUG(llvm::dbgs() << "not a subbyte type\n"); | ||
| return nullptr; | ||
| } | ||
| if (options.subByteTypeStorage != SPIRVSubByteTypeStorage::Packed) { | ||
| LLVM_DEBUG(llvm::dbgs() << "unsupported sub-byte storage kind\n"); | ||
| return nullptr; | ||
|
|
@@ -348,6 +354,9 @@ convertVectorType(const spirv::TargetEnv &targetEnv, | |
| } | ||
|
|
||
| Type elementType = convertSubByteIntegerType(options, intType); | ||
| if (!elementType) | ||
| return nullptr; | ||
|
Comment on lines
+357
to
+358
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bug is that previously, it was assumed that if we entered this code path, the integer type was unsupported because of being sub-byte, but it might be unsupported for some other reason?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The bug was essentially that it assumed that
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks. If you want to, you could put this in the pull-request description so it ends up in the commit message, but that may be unnecessary. |
||
|
|
||
| if (type.getRank() <= 1 && type.getNumElements() == 1) | ||
| return elementType; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.