[Mlir-commits] [mlir] [MLIR][Linalg] Diagnose unsupported types in Linalg named op region builders (PR #181616)
Matthias Springer
llvmlistbot at llvm.org
Mon Feb 16 03:30:37 PST 2026
================
@@ -2128,3 +2128,45 @@ func.func @matmul_invalid_mixed_types(%t: tensor<?xf16>, %f: vector<4xf16>)
outs(%f : vector<4xf16>) -> tensor<?xf16>
func.return %0, %f : tensor<?xf16>, vector<4xf16>
}
+
+// -----
+
+func.func @batch_matmul_invalid_type()
+{
+ %0 = spirv.GroupNonUniformElect <Workgroup> : i1
+ %1 = amx.tile_zero : !amx.tile<16x16xbf16>
+ %2 = tensor.from_elements %0 : tensor<i1>
+ %3 = tosa.reciprocal %2 : (tensor<i1>) -> tensor<i1>
+ %4 = shape.const_shape [16, 16] : !shape.shape
+ // expected-error @below {{custom op 'linalg.batch_matmul' Cannot build binary Linalg operation: expects allComplex, allFloatingPoint, or allInteger, got '!amx.tile<16x16xbf16>' and '!amx.tile<16x16xbf16>'}}
+ %5 = linalg.batch_matmul ins(%1, %1 : !amx.tile<16x16xbf16>, !amx.tile<16x16xbf16>) outs(%1 : !amx.tile<16x16xbf16>) -> !amx.tile<16x16xbf16>
+ return
+}
+
+// -----
+
+func.func @batch_reduce_matmul_invalid_type()
+{
+ %0 = spirv.GroupNonUniformElect <Workgroup> : i1
+ %1 = amx.tile_zero : !amx.tile<16x16xbf16>
+ %2 = tensor.from_elements %0 : tensor<i1>
+ %3 = tosa.reciprocal %2 : (tensor<i1>) -> tensor<i1>
+ %4 = shape.const_shape [16, 16] : !shape.shape
+ // expected-error @below {{custom op 'linalg.batch_reduce_matmul' Cannot build binary Linalg operation: expects allComplex, allFloatingPoint, or allInteger, got '!amx.tile<16x16xbf16>' and '!amx.tile<16x16xbf16>'}}
+ %5 = linalg.batch_reduce_matmul ins(%1, %1 : !amx.tile<16x16xbf16>, !amx.tile<16x16xbf16>) outs(%1 : !amx.tile<16x16xbf16>) -> !amx.tile<16x16xbf16>
+ return
+}
+
+// -----
+
+func.func @matmul_invalid_type()
+{
+ %0 = spirv.GroupNonUniformElect <Workgroup> : i1
+ %1 = amx.tile_zero : !amx.tile<16x16xbf16>
+ %2 = tensor.from_elements %0 : tensor<i1>
+ %3 = tosa.reciprocal %2 : (tensor<i1>) -> tensor<i1>
+ %4 = shape.const_shape [16, 16] : !shape.shape
+ // expected-error @below {{custom op 'linalg.matmul' Cannot build binary Linalg operation: expects allComplex, allFloatingPoint, or allInteger, got '!amx.tile<16x16xbf16>' and '!amx.tile<16x16xbf16>'}}
+ %5 = linalg.matmul ins(%1, %1 : !amx.tile<16x16xbf16>, !amx.tile<16x16xbf16>) outs(%1 : !amx.tile<16x16xbf16>) -> !amx.tile<16x16xbf16>
----------------
matthias-springer wrote:
Try to keep the test cases as small as possible. All operations in the function body apart from `%5 = linalg.matmul` can probably be removed.
https://github.com/llvm/llvm-project/pull/181616
More information about the Mlir-commits
mailing list