[Mlir-commits] [mlir] [mlir][vector] Disallow vector broadcast along scalable dim (PR #212197)

Andrzej WarzyƄski llvmlistbot at llvm.org
Tue Aug 4 07:55:16 PDT 2026


================
@@ -254,6 +254,23 @@ func.func @broadcast_vec2d_from_vec1d_scalable_leading(%arg0: vector<2xf32>) ->
 
 // -----
 
+// TODO: Add support for scalable vectors
+
+func.func @broadcast_vec2d_from_vec1d_scalable_inner(%arg0: vector<2xf32>) -> vector<3x[4]x2xf32> {
+  %0 = vector.broadcast %arg0 : vector<2xf32> to vector<3x[4]x2xf32>
+  return %0 : vector<3x[4]x2xf32>
+}
+// CHECK-LABEL: @broadcast_vec2d_from_vec1d_scalable_inner
+// CHECK-SAME:  %[[A:.*]]: vector<2xf32>)
+// CHECK:       %[[T0:.*]] = ub.poison : vector<3x[4]x2xf32>
+// CHECK:       %[[T1:.*]] = vector.broadcast %[[A]] : vector<2xf32> to vector<[4]x2xf32>
+// CHECK:       %[[T2:.*]] = vector.insert %[[T1]], %[[T0]] [0] : vector<[4]x2xf32> into vector<3x[4]x2xf32>
+// CHECK:       %[[T3:.*]] = vector.insert %[[T1]], %[[T2]] [1] : vector<[4]x2xf32> into vector<3x[4]x2xf32>
+// CHECK:       %[[T4:.*]] = vector.insert %[[T1]], %[[T3]] [2] : vector<[4]x2xf32> into vector<3x[4]x2xf32>
+// CHECK:       return %[[T4]] : vector<3x[4]x2xf32>
+
+// -----
+
----------------
banach-space wrote:

Thank you for adding this - now I see what you meant. I do think it's a useful test - it shows that the transformation "partially" worked (as expected).

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


More information about the Mlir-commits mailing list