[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
Mon Dec 5 07:48:39 PST 2022
qcolombet added inline comments.
================
Comment at: mlir/lib/Dialect/MemRef/Transforms/ExpandStridedMetadata.cpp:453
+ // since the collapsed dimensions are contiguous.
+ auto minMap = AffineMap::getMultiDimIdentityMap(groupStrides.size(),
+ builder.getContext());
----------------
If we need to support the dynamic case with "non-truly-contiguous" dimensions of size 1, we could do a quick and dirty fix here where we could generate:
```
%stride_i = size_i != 1? origStride_i: int_max
%resulting_stride_i = min(stride_j for j in reassociation group)
```
The codegen won't be pretty, but it would be correct in the general case. I just don't know if it's worth it right now.
For the static case, it definitely worth it, because we see it happening in real workloads.
@springerm should be able to tell us if we need to support the dynamic case short term with the asserts he is adding for the dynamic cases.
Alternatively, @bkramer do you know if we need to support the dynamic case right now?
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