[Mlir-commits] [mlir] [mlir][memref] Add a new `ReifyResultShapes` pass (PR #145927)
Fabian Mora
llvmlistbot at llvm.org
Thu Jun 26 13:37:46 PDT 2025
fabianmcg wrote:
We might need to update the docs, because at least I cannot infer that from the docs:
```
def ReifyRankedShapedTypeOpInterface :
OpInterface<"ReifyRankedShapedTypeOpInterface"> {
let description = [{
Interface to compute the shape of the result of an operation when
the result is a ranked shape type, i.e. `RankedTensorType` or
`MemRefType`.
}];
let cppNamespace = "::mlir";
let methods = [
InterfaceMethod<
/*desc=*/[{
Reify the shape of the result of an operation (typically in terms of the
shape of its operands).
`reifiedReturnShapes` is populated with one vector per op result. Each
of those vectors contains an OpFoldResult for each dimension of the
shaped type. The given builder may be used to insert ops that compute
result shapes.
If the shape of a particular result cannot be computed it must be empty.
}],
/*retTy=*/"::llvm::LogicalResult",
/*methodName=*/"reifyResultShapes",
/*args=*/(ins "::mlir::OpBuilder &":$builder,
"::mlir::ReifiedRankedShapedTypeDims &":$reifiedReturnShapes)
>
];
}
```
Also, there's no cast to fold into or from in this case. So no way to augment those patterns.
Finally, I'd argue that ir is reification because we are coming from dynamic dimensions and inferring that the output type is static.
https://github.com/llvm/llvm-project/pull/145927
More information about the Mlir-commits
mailing list