[Mlir-commits] [mlir] [MLIR][Linalg] Fix crash on duplicate dimensions in linalg.broadcast (PR #211203)
Chibuoyim Ogbonna
llvmlistbot at llvm.org
Thu Jul 23 06:08:07 PDT 2026
================
@@ -1196,6 +1196,30 @@ func.func @broadcast_size_1_extension_not_supported(
// -----
+func.func @broadcast_duplicate_dims(
+ %input: tensor<i32>, %init: tensor<32x2xi32>) -> tensor<32x2xi32> {
+ // expected-error @+1 {{'linalg.broadcast' op dimensions should not contain duplicates}}
+ %bcast = linalg.broadcast
+ ins(%input:tensor<i32>)
+ outs(%init:tensor<32x2xi32>)
+ dimensions = [0, 0]
+ func.return %bcast : tensor<32x2xi32>
+}
+
+// -----
+
+func.func @broadcast_scalar_input(
+ %input: f32, %init: tensor<8x16xf32>) -> tensor<8x16xf32> {
+ // expected-error @+1 {{'linalg.broadcast' op operand #0 must be memref of any non-token type values or ranked tensor of any non-token type values, but got 'f32'}}
----------------
bruteforceboy wrote:
I think it does make sense to be able to broadcast a scalar just like we do for the OD case.
https://github.com/llvm/llvm-project/pull/211203
More information about the Mlir-commits
mailing list