[Mlir-commits] [mlir] Let memref.collapse_shape implement ReifyRankedShapedTypeOpInterface. (PR #107752)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Sep 18 22:49:16 PDT 2024


https://github.com/MaheshRavishankar requested changes to this pull request.

I dont see a reason to bail for dynamic dimensions. If the reassociation indices associated with a result is a `SmallVector<int64_t> reassociation;

```
AffineExpr s0, s1;
bindSymbols(rewriter.getContext(), s0, s1);
AffineExpr mulExpr = s0 * s1;
auto getDimAsOpFoldResult(Value v, int64_t dim) {
  return getAsOpFoldResult(rewriter.create<tensor::DimOp>(loc, v, dim));
};
OpFoldResult resultDim = getDimAsOpFoldResult(source, reassociation.front());
for (auto dim : reassociation.drop_front()) {
  resultDim = affine::makeComposedFoldedAffineApplyOp(rewriter, mulExpr, {resultDim,
   getDimAsOpFoldResult(source, dim)});
}
```

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


More information about the Mlir-commits mailing list