[PATCH] D139329: [mlir][ExpandStridedMetadata] Handle collapse_shape of dim of size 1 gracefully

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 8 06:43:26 PST 2022


qcolombet added inline comments.


================
Comment at: mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp:473
+  } else if (groupStrides.size() == 1) {
+    // TODO: affine.min should probably fold `min(a)` => `a`.
+    collapsedStride.push_back(groupStrides[0]);
----------------
qcolombet wrote:
> jreiffers wrote:
> > Or maybe just do this now?
> I feel that this should be its own PR.
> 
> In the meantime, I could drop this specialization and temporarily generate `min(a)`, that'll probably be clearer.
> 
> What do you think?
FYI, I filed https://github.com/llvm/llvm-project/issues/59399 for the missing folding pattern `min(a) -> a` in affine.

This is not a problem for codegen in practice since the lowering will properly propagate the one value involved in this expression, but that would be a nice clean-up nonetheless.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139329/new/

https://reviews.llvm.org/D139329



More information about the llvm-commits mailing list