Added InferReturnTypeComponents for NAry operations, reshape, and reverse.
With the additional tosa-infer-shapes pass, we can infer/propagate shapes
across a set of TOSA operations. Current version does not modify the
FuncOp type by inserting an unrealized conversion cast prior to any new
non-matchin returns.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp | ||
---|---|---|
37 | I don't think lhs or rhs can ever be null here for this pass. | |
197 | This is not correct, as it can change the result types. You need to check that all users allow their types to be updated to the new type in place. | |
206 | Why can't you use a tensor.cast op? |
Addressed comments about tensor.cast, added dependent dialects, and removed uneeded type checks.
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp | ||
---|---|---|
197 | you shouldn't need to update each use like this (setting the type on the value updates all uses automatically since they just point at the value). I meant that you should check that all users are tosa ops and not some random op that doesn't allow its operand types to be changed. | |
202 | nit: update comments |
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp | ||
---|---|---|
197 | I restricted to ReturnOp and TosaDialect operations. In the future it should probably be expanded to include Call and some other standard ops. | |
206 | When I chatted with Stella she suggested unrealized cast so that a later pass can correct return types on the function. I changed to a tensor.cast operation but either should be fine for this usecase. |
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp | ||
---|---|---|
210 | You shouldn't need any of this stuff updating originalUses. |
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp | ||
---|---|---|
197 | See version committed just as you added this comment. |
mlir/lib/Dialect/Tosa/Transforms/TosaInferShapes.cpp | ||
---|---|---|
197 | Oh, sorry. I guess phabricator was racy. |
clang-tidy: warning: invalid case style for function 'ResolveBroadcastShape' [readability-identifier-naming]
not useful