masahi commented on code in PR #14097:
URL: https://github.com/apache/tvm/pull/14097#discussion_r1116346831


##########
src/relax/transform/fuse_ops.cc:
##########
@@ -490,15 +483,13 @@ class FunctionCreator : public ExprMutator {
 
   /*!
    * \brief Check whether the input expression is defined within this 
function. If not, create a new
-   * parameter for the expression.
+   * parameter for the expression. The caller is responsible for deduplicating 
expressions in
+   * arguments_ if needed.
    * \param expr The expression to be checked
+   * \return true if the input expression is added as a parameter of the 
grouped function being
+   * created.
    */
-  void CheckDefAndUpdateParam(const Expr& expr) {
-    // If the expression has already served as an argument, no need to create 
another one for it.
-    if (std::find(arguments_.begin(), arguments_.end(), expr) != 
arguments_.end()) {
-      return;
-    }

Review Comment:
   cc @Hzfengsy, I decoupled deduplication check and the actual param update in 
this function, to allow duplicated expressions in `arguments_` and `params_`. 
As the comment at L486 says, it is now a responsibility of the caller to do 
deduplication beforehand if dedup is needed. 
   
   See also the discussion in 
https://github.com/apache/tvm/pull/14097/files#r1116338447



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to