[Mlir-commits] [mlir] [MLIR][Linalg] Diagnose unsupported types in Linalg named op region builders (PR #181616)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Mon Feb 16 22:51:44 PST 2026
================
@@ -6582,13 +6589,18 @@ void BatchReduceMatmulOp::regionBuilder(
SmallVector<Value> yields;
auto toType = block.getArgument(2).getType();
- Value castValA =
- helper.buildTypeFn(TypeFn::cast_signed, toType, block.getArgument(0));
- Value castValB =
- helper.buildTypeFn(TypeFn::cast_signed, toType, block.getArgument(1));
- Value mulVal = helper.buildBinaryFn(BinaryFn::mul, castValA, castValB);
+ Value castValA = helper.buildTypeFn(TypeFn::cast_signed, toType,
+ block.getArgument(0), emitError);
+ Value castValB = helper.buildTypeFn(TypeFn::cast_signed, toType,
+ block.getArgument(1), emitError);
+ Value mulVal =
+ helper.buildBinaryFn(BinaryFn::mul, castValA, castValB, emitError);
+ if (!castValA || !castValB || !mulVal)
+ return;
Value addVal =
helper.buildBinaryFn(BinaryFn::add, block.getArgument(2), mulVal);
+ if (!addVal)
----------------
shubhamnarlawar wrote:
In case of amx.tile as operand which is not supported, mulVal is null and hence if I pass null value to add, it reaches llvm_unreachable() in buildBinaryFn() and crashes as below -
`invalid.mlir:4:35: error: custom op 'linalg.batch_reduce_matmul' Cannot build binary Linalg operation: expects allComplex, allFloatingPoint, or allInteger, got '!amx.tile<16x16xbf16>' and '!amx.tile<16x16xbf16>'
%1 = linalg.batch_reduce_matmul ins(%0, %0 : !amx.tile<16x16xbf16>, !amx.tile<16x16xbf16>) outs(%0 : !amx.tile<16x16xbf16>) -> !amx.tile<16x16xbf16>
^
unsupported non numeric type
UNREACHABLE executed at /home/shubham/work/llvm-project/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp:516!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0. Program arguments: ../build/bin/mlir-opt invalid.mlir
1. MLIR Parser: custom op parser 'func.func'
2. MLIR Parser: custom op parser 'linalg.batch_reduce_matmul'`
https://github.com/llvm/llvm-project/pull/181616
More information about the Mlir-commits
mailing list