[Mlir-commits] [mlir] [mlir][tosa] Enhance TosaInferShapes pass for simple shape inference (PR #178418)
Tai Ly
llvmlistbot at llvm.org
Mon Feb 23 08:14:03 PST 2026
================
@@ -333,13 +161,252 @@ void validateSameOperandsAndResultRankTrait(Region ®ion) {
struct TosaInferShapes
: public tosa::impl::TosaInferShapesPassBase<TosaInferShapes> {
public:
+ explicit TosaInferShapes() = default;
+ explicit TosaInferShapes(const TosaInferShapesPassOptions &options)
+ : TosaInferShapes() {
+ this->foldShapeExpressions = options.foldShapeExpressions;
+ this->convertFunctionBoundaries = options.convertFunctionBoundaries;
+ }
+
void runOnOperation() override {
func::FuncOp func = getOperation();
TypeModificationState state;
propagateShapesInRegion(func.getBody(), state);
state.commit();
validateSameOperandsAndResultRankTrait(func.getBody());
+
+ if (convertFunctionBoundaries)
+ convertFunctionReturnTypes(func);
----------------
Tai78641 wrote:
I think this works, but not as obvious whether it cleans up complicated shape expressions (I think it does).
https://github.com/llvm/llvm-project/pull/178418
More information about the Mlir-commits
mailing list