[Mlir-commits] [mlir] [mlir][fold-memref-alias-ops] Add support for folding memref.expand_shape involving dynamic dims (PR #89093)
Prathamesh Tagore
llvmlistbot at llvm.org
Tue Apr 23 00:09:49 PDT 2024
================
@@ -63,39 +63,99 @@ resolveSourceIndicesExpandShape(Location loc, PatternRewriter &rewriter,
memref::ExpandShapeOp expandShapeOp,
ValueRange indices,
SmallVectorImpl<Value> &sourceIndices) {
- // The below implementation uses computeSuffixProduct method, which only
- // allows int64_t values (i.e., static shape). Bail out if it has dynamic
- // shapes.
- if (!expandShapeOp.getResultType().hasStaticShape())
- return failure();
-
+ // Record the rewriter context for constructing ops later.
MLIRContext *ctx = rewriter.getContext();
+
+ // Record result type to get result dimensions for calulating suffix product
+ // later.
+ ShapedType resultType = expandShapeOp.getResultType();
+
+ // Traverse all reassociation groups to determine the appropriate indice
+ // corresponding to each one of them post op folding.
----------------
meshtag wrote:
Do you think this change will break anything in that patch? (I don't see any changes in this pass in that patch)
Is that patch introducing better analysis utilities? (which can probably help us deal with dynamic and static cases in one go? - as you mentioned above)
I have no problem waiting for that change to get in if it somehow helps us better this patch.
https://github.com/llvm/llvm-project/pull/89093
More information about the Mlir-commits
mailing list