[Mlir-commits] [mlir] [mlir][fold-memref-alias-ops] Add support for folding memref.expand_shape involving dynamic dims (PR #89093)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 1 17:20:49 PDT 2024


MaheshRavishankar wrote:

> @MaheshRavishankar, I've rebased this PR and resolved all merge conflicts.
> 
> I tried using `getOutputShape` utility added in the `expand_shape` PR referenced above, it ended up generating the same IR which we have atm using `memref.dim` op. The current logic for this seems less convoluted to me as `getOutputShape` returns only dynamic shapes (not immediately obvious to me - maybe consider naming it as `getDynamicOutputShape`?), so we would have to keep an additional variable to track the number of dynamic dimensions accessed and then pass that each time we want to get a dynamic dimension.
> 
> Let me know your thoughts on this.

I was thinking you can use https://github.com/llvm/llvm-project/blob/4b75fcf0a50f4be955b611e8e20d84d90ea133c8/mlir/lib/Dialect/Arith/Utils/Utils.cpp#L24 which should return a mixed static dynamic list like you are doing here. Isnt this what you are looking to do here as well?

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


More information about the Mlir-commits mailing list