[Mlir-commits] [mlir] [mlir][vector] Flatten transfer - support multi-dim scalar element (PR #185417)

Adam Siemieniuk llvmlistbot at llvm.org
Mon Mar 9 09:09:16 PDT 2026


================
@@ -835,11 +835,19 @@ class FlattenContiguousRowMajorTransferReadPattern
       return failure();
     }
 
+    // Determine vector dimensions to collapse.
+    // Ignore a leading sequence of adjacent unit dimensions in the vector.
+    ArrayRef<int64_t> collapsedVectorShape =
+        vectorType.getShape().drop_while([](auto v) { return v == 1; });
+    size_t collapsedVecRank = collapsedVectorShape.size();
+    // In case of a multi-dimensional scalar vector, restrict the shape collapse
+    // to a 1D vector.
----------------
adam-smnk wrote:

Fair, I use these terms loosely 😅
Rephrased to use "unit vector" and "single element" scheme.

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


More information about the Mlir-commits mailing list