[Mlir-commits] [mlir] [mlir][tensor] Enhance SimplifyUnPackToCollapseShape for unit dim cases. (PR #79262)
Han-Chung Wang
llvmlistbot at llvm.org
Thu Jan 25 04:27:59 PST 2024
================
@@ -134,9 +135,36 @@ struct SimplifyUnPackToCollapseShape : public OpRewritePattern<UnPackOp> {
ArrayRef<int64_t> dimsPos = unpackOp.getInnerDimsPos();
if (dimsPos.size() != 1 || (dimsPos[0] + 1 != destType.getRank())) {
return rewriter.notifyMatchFailure(
- unpackOp, "expects unpacking at the innermost dimension");
+ unpackOp, "expects unpacking on the innermost dimension");
}
+ return success();
+ }
+
+ /// Returns success() if it unpacks a 1D or 2D source operand to a 1D
----------------
hanhanW wrote:
The 1D/2D means that the number of dimension with `size>1`. The check about `getNumGtOneDims(destShape) <= 1` guarantees that the non-packed domain is either 0D or 1D. And the `getNumGtOneDims(innerTiles) <= 1` part guarantees that the packed is either 1D or 2D. Thus I think i is unpacking a 1D or 2D source value to a 0D or 1D value.
https://github.com/llvm/llvm-project/pull/79262
More information about the Mlir-commits
mailing list