billishyahao commented on code in PR #11513:
URL: https://github.com/apache/tvm/pull/11513#discussion_r894031165


##########
src/relay/backend/contrib/dnnl/codegen.cc:
##########
@@ -436,6 +436,38 @@ class DNNLModuleCodegen : public CSourceModuleCodegenBase {
 
 #else  // DNNL JSON runtime
 
+/*!
+ * \brief Retrieve the expected "root" op nested inside a fused call, such as 
conv2d in
+ *        relu(add(conv2d))
+ * \param call A Relay call node. Typically nn.relu when called the first time.
+ * \param max_depth The maximum number of calls before the root op, counting 
from current_call.
+ * \param root_name The name of expected "root" op in this fused call.
+ * \return A CallNode corresponding to the root op
+ */
+inline const CallNode* FindCallWithName(const CallNode* current_call, int 
max_depth,
+                                        const std::string& root_name) {

Review Comment:
   Hi @masahi , I can move this func "FindCallWithName" to utils.h.
   Old style func "GetRootCall" is not enough for this case. I shall refactor 
it by adding the following lines to retrieve the last valid node index:
   
   ```
   size_t valid_node_idx = 0;
   while (valid_node_idx < current_call->args.size() && 
current_call->args[valid_node_idx].as<VarNode>()) {
        valid_node_idx++;
   }
   ```



-- 
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