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

Benjamin Maxwell llvmlistbot at llvm.org
Thu Jun 6 02:35:20 PDT 2024


================
@@ -79,6 +79,65 @@ 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>  ┘
----------------
MacDue wrote:

The single `%result` is fine (misread this), but the type of the result is not correct. 

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


More information about the Mlir-commits mailing list