Lunderberg commented on code in PR #16598: URL: https://github.com/apache/tvm/pull/16598#discussion_r1496737460
########## src/relax/transform/fuse_ops.cc: ########## @@ -1238,10 +1238,14 @@ class CompositeFunctionAnnotator : public ExprMutator { Expr VisitExpr_(const FunctionNode* func_node) final { Function f_inner = Downcast<Function>(ExprMutator::VisitExpr_(func_node)); - auto composite_name = func_node->GetAttr<String>(attr::kComposite); + + if (!func_node->GetAttr<String>(attr::kComposite)) { Review Comment: The `PatternBasedPartitioner` only visits non-composite functions, produces a composite function for each pattern match, and updates the non-composite function to call the newly-generated composite function. Afterwards, the call to [`CompositeFunctionAnnotator`](https://github.com/apache/tvm/blob/main/src/relax/transform/fuse_ops.cc#L1289) is called. This visits only non-composite functions, finds any relax-to-relax function calls, and asserts that the callee is composite. The callee will be composite for every function call generated by `PatternBasedPartitioner`, but that doesn't guarantee that all relax-to-relax function calls have a composite callee. If the `IRModule` contains a relax-to-relax call prior to `PatternBasedPartitioner`, that callee may be non-composite. This IRModule would be entirely legal, but would trigger the assert in `CompositeFunctionAnnotator`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@tvm.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org