[Mlir-commits] [mlir] [mlir][linalg] Fix rank-reducing insert_slice vectorization writing to wrong dims (PR #226490)

Dhairyashil R G llvmlistbot at llvm.org
Sun Oct 4 09:10:43 PDT 2026


================
@@ -334,3 +345,133 @@ func.func private @insert_slice_non_zero_offset_for_dyn_dim(%source: tensor<?x3x
     transform.yield
   }
  }
+
+// -----
+
+/// A 1-D source inserted down a column: the dropped dim is the trailing one,
+/// so the source's only dim corresponds to result dim 0.
+
+func.func private @insert_slice_1d_source_into_column(
+    %source: tensor<5xi32>) -> tensor<5x3xi32> {
+  %pad = arith.constant 0 : i32
+  %empty = tensor.empty() : tensor<5x3xi32>
+  %init = linalg.fill ins(%pad : i32) outs(%empty : tensor<5x3xi32>) -> tensor<5x3xi32>
+  %res = tensor.insert_slice %source into %init[0, 2] [5, 1] [1, 1] : tensor<5xi32> into tensor<5x3xi32>
+  return %res : tensor<5x3xi32>
+}
----------------
dhairyashilRG wrote:

It doesn't: like `@insert_slice_dynamic_src_dim_trailing_unit_dim_dropped`, it drops the trailing unit dim and is written without a mask. I removed it. The integration test still runs this input.

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


More information about the Mlir-commits mailing list