[Mlir-commits] [mlir] [mlir][spirv] Handle vectors of integers of unsupported width (PR #118663)

Andrea Faulds llvmlistbot at llvm.org
Wed Dec 4 08:25:18 PST 2024


================
@@ -299,6 +299,10 @@ convertScalarType(const spirv::TargetEnv &targetEnv,
 /// 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;
+  }
----------------
andfau-amd wrote:

This feels like a strange thing to have a runtime error for; if it's for convenience, maybe it should be documented (that nothing is returned if it's not sub-byte), but otherwise it feels like something you'd use an `assert` for, as it represents a bug if this is called on a non-sub-byte type? Maybe others would disagree with me.

https://github.com/llvm/llvm-project/pull/118663


More information about the Mlir-commits mailing list