[Mlir-commits] [mlir] [mlir][ArithToSPIRV] Fix crash on tensor arith.uitofp/sitofp lowering (PR #227102)
Vinicius Silva
llvmlistbot at llvm.org
Tue Sep 29 04:59:54 PDT 2026
https://github.com/viniciusfdasilva updated https://github.com/llvm/llvm-project/pull/227102
>From 15d22fdf20bb62ed900a429804f9b5ed9781d126 Mon Sep 17 00:00:00 2001
From: Vinicius Silva <viniciusilva at ieee.org>
Date: Mon, 28 Sep 2026 20:11:41 +0000
Subject: [PATCH 1/2] [mlir][ArithToSPIRV] Fix crash on tensor
arith.uitofp/sitofp lowering (#226380)
---
mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
index 40c0ac7064fdb..8d44c343f73e2 100644
--- a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
+++ b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
@@ -731,6 +731,14 @@ struct IntToFPPattern final : public OpConversionPattern<ArithOp> {
// Check if the source integer type was widened during type conversion.
unsigned originalBitwidth =
getElementTypeOrSelf(op.getIn().getType()).getIntOrFloatBitWidth();
+
+ if (!srcType ||
+ !(isa<IntegerType, FloatType>(getElementTypeOrSelf(srcType)) ||
+ isa<mlir::VectorType>(srcType))) {
+ return rewriter.notifyMatchFailure(op,
+ "unsupported type for uitofp/sitofp");
+ }
+
unsigned convertedBitwidth =
getElementTypeOrSelf(srcType).getIntOrFloatBitWidth();
>From 3f29207643950b5864d39656093e03b7fec0fd73 Mon Sep 17 00:00:00 2001
From: Vinicius Silva <viniciusilva at ieee.org>
Date: Tue, 29 Sep 2026 08:59:42 -0300
Subject: [PATCH 2/2] Update mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
Co-authored-by: Igor Wodiany <dev at wodiany.com>
---
mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
index 8d44c343f73e2..90a6860da2e36 100644
--- a/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
+++ b/mlir/lib/Conversion/ArithToSPIRV/ArithToSPIRV.cpp
@@ -734,7 +734,7 @@ struct IntToFPPattern final : public OpConversionPattern<ArithOp> {
if (!srcType ||
!(isa<IntegerType, FloatType>(getElementTypeOrSelf(srcType)) ||
- isa<mlir::VectorType>(srcType))) {
+ isa<VectorType>(srcType))) {
return rewriter.notifyMatchFailure(op,
"unsupported type for uitofp/sitofp");
}
More information about the Mlir-commits
mailing list