[Mlir-commits] [mlir] [mlir][vector] Add n-d deinterleave lowering (PR #94237)

Benjamin Maxwell llvmlistbot at llvm.org
Wed Jun 5 08:20:47 PDT 2024


================
@@ -79,6 +79,67 @@ class UnrollInterleaveOp final : public OpRewritePattern<vector::InterleaveOp> {
   int64_t targetRank = 1;
 };
 
+/// A one-shot unrolling of vector.deinterleave to the `targetRank`.
+///
+/// Example:
+///
+/// ```mlir
+/// vector.deinterleave %a : vector<1x2x3x8xi64> -> vector<1x2x3x4xi64>
+/// ```
+/// Would be unrolled to:
+/// ```mlir
+/// %result = arith.constant dense<0> : vector<1x2x3x8xi64>
+/// %0 = vector.extract %a[0, 0, 0]                 ─┐
+///        : vector<4xi64> from vector<1x2x3x4xi64>  |  | - Repeated 6x for
+/// %1, %2 = vector.deinterleave %0 :                |      all leading
+/// positions
+///        : vector<8xi64> -> vector<4xi64>          |
+/// %3 = vector.insert %1, %result [0, 0, 0]         |
+///        : vector<4xi64> into vector<1x2x3x4xi64>  |
+/// %3 = vector.insert %2, %result [0, 0, 0]         |
+///        : vector<4xi64> into vector<1x2x3x4xi64>  ┘
+/// ```
+///
+/// Note: If any leading dimension before the `targetRank` is scalable the
+/// unrolling will stop before the scalable dimension.
+
----------------
MacDue wrote:

nit: remove this newline:
```suggestion
```

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


More information about the Mlir-commits mailing list