[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
       
    Sun May  5 19:40:28 PDT 2024
    
    
  
MaheshRavishankar wrote:
IIUC what you are trying to do is effectively this
```
SmallVector<OpFoldResult> sizes = .... 
AffineExpr s0, s1;
bindSymbol(builder.getContext(), s0, s1);
OpFoldResult product = builder.getIndexAttr(1);
SmallVector<OpFoldResult> suffixProduct(sizes.size());
int index = sizes.size() - 1;
suffixProduct[index--] = product;
for (auto size : llvm::reverse(sizes.drop_front())) {
  product = affine::makeComposedFoldedAffineApply(builder, loc, s0 * s1, {product, size});
  suffixProduct[index--] = product;
}
return suffixProduct.
```
The mixed static dynamic cases will all be handled automatically? and the `sizes` is what is returned by the `inferOutputShape`. I dont see why the logic needs to be duplicated.
https://github.com/llvm/llvm-project/pull/89093
    
    
More information about the Mlir-commits
mailing list