[Mlir-commits] [mlir] [mlir][VectorOps] Add `vector.interleave` operation (PR #80315)
Benjamin Maxwell
llvmlistbot at llvm.org
Mon Feb 5 04:22:25 PST 2024
================
@@ -6308,6 +6308,48 @@ bool WarpExecuteOnLane0Op::areTypesCompatible(Type lhs, Type rhs) {
verifyDistributedType(lhs, rhs, getWarpSize(), getOperation()));
}
+//===----------------------------------------------------------------------===//
+// InterleaveOp
+//===----------------------------------------------------------------------===//
+
+// The rank 1 case of vector.interleave on fixed-size vectors is equivalent to a
+// vector.shuffle, which (as an older op) is more likely to be matched by
+// existing pipelines.
+struct FoldRank1FixedSizeInterleaveOp : public OpRewritePattern<InterleaveOp> {
----------------
MacDue wrote:
I'll just remove this canonicalization entirely, though I think the introduction of this op means there's no longer a clear canonical representation for a fixed-size interleave.
My reasoning for adding this was, until now `vector.shuffle` has been the only way to represent this for fixed-sized 1D vectors (for years). So people are likely to be used to using `vector.shuffle` for fixed-size interleaves and have patterns that match that, so in that sense, `vector.shuffle` is more canonical. I don't think `vector.interleave` provides any more information in the case either, once you've matched the shuffle mask, the semantics are identical.
---
I would not be surprised if adding a `vector.shuffle` -> `vector.interleave` canonicalization broke something somewhere (maybe in a downstream project).
https://github.com/llvm/llvm-project/pull/80315
More information about the Mlir-commits
mailing list