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

Andrzej WarzyƄski llvmlistbot at llvm.org
Sun Oct 4 04:34:22 PDT 2026


================
@@ -0,0 +1,53 @@
+// DEFINE: %{entry_point} = main
+// DEFINE: %{lower} = -one-shot-bufferize=bufferize-function-boundaries \
+// DEFINE:   -buffer-deallocation-pipeline -convert-linalg-to-loops \
+// DEFINE:   -convert-vector-to-scf -lower-affine
+// DEFINE: %{run} = mlir-runner -e %{entry_point} -entry-point-result=void \
+// DEFINE:    -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils
----------------
banach-space wrote:

1. Some passes can be skipped (e.g. `-lower-affine`)
2. The execution of the TD schedule is controlled with `-transform-interpreter` rather than `-test-transform-dialect-erase-schedule`.
3. I propose adding a dedicated "vectorization" step - this way the difference between the two `RUN` lines becomes very clear.

```suggestion
// DEFINE: %{entry_point} = main

// DEFINE: %{vectorize} = mlir-opt -transform-interpreter
// DEFINE: %{lower} = mlir-opt -one-shot-bufferize=bufferize-function-boundaries \
// DEFINE:   -test-lower-to-llvm -test-transform-dialect-erase-schedule
// DEFINE: %{run} = mlir-runner -e %{entry_point} -entry-point-result=void \
// DEFINE:    -shared-libs=%mlir_runner_utils,%mlir_c_runner_utils

/// End-to-end test for vectorizing a rank-reducing tensor.insert_slice. Both
/// runs use the same lowering and must print the same thing.

/// _Without_ vectorization (reference)
// RUN: %{lower} %s | %{run} | FileCheck %s

/// _With_ vectorization
// RUN: %{vectorize} %s | %{lower} | %{run} | FileCheck %s
```

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


More information about the Mlir-commits mailing list