[Mlir-commits] [mlir] [mlir][linalg] Reject unsigned pooling on non-integer element types (PR #166070)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Nov 21 04:51:34 PST 2025


================
@@ -579,13 +579,23 @@ class RegionBuilderHelper {
       return arith::MinSIOp::create(builder, arg0.getLoc(), arg0, arg1);
     case BinaryFn::max_unsigned:
       assert(!allComplex);
-      if (allFloatingPoint)
-        return arith::MaximumFOp::create(builder, arg0.getLoc(), arg0, arg1);
+      if (!allInteger || allBool) {
+        if (emitError) {
+          emitError() << "unsupported operation: unsigned max not on uint";
+          return nullptr;
+        }
+        llvm_unreachable("unsupported operation: unsigned max not on uint");
+      }
----------------
Men-cotton wrote:

Hi @banach-space , thank you for the suggestion.
I actually already added a verification test in `mlir/test/Dialect/Linalg/named-ops-fail.mlir`. If you prefer `invalid.mlir` or find the current test insufficient, please let me know.

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


More information about the Mlir-commits mailing list