You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/04/29 21:39:59 UTC

[GitHub] [tvm] tqchen commented on a change in pull request #7945: [RELAY] Turn reshape into nop in graph executor backend.

tqchen commented on a change in pull request #7945:
URL: https://github.com/apache/tvm/pull/7945#discussion_r623420830



##########
File path: src/relay/backend/graph_executor_codegen.cc
##########
@@ -380,6 +380,19 @@ class GraphExecutorCodegen : public backend::MemoizedExprTranslator<std::vector<
       return GraphAddCallNode(op, ext_func->func_name, ext_func->func_name);
     }
 
+    // In the current flat memory allocation scenario
+    // the flat memory allocator can always allocate input
+    // and output of the reshape to the same memory, we can turn reshape only
+    // function to a nop.
+    //
+    // NOTE that for non-flat memory this is not necessarily true.
+    //
+    // TODO(tvm-team) Update checks of flat memory enablement when we support
+    // opaque-nd memory planning to skip this path.
+    if (func->HasNonzeroAttr(attr::kReshapeOnly)) {
+      return GraphAddCallNode(op, "reshape_nop", "__nop");
+    }

Review comment:
       My previous thoughts was nd allocation will have a separate executor generation path, agree that cross checking would be more desirable




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org