Mousius commented on a change in pull request #8974:
URL: https://github.com/apache/tvm/pull/8974#discussion_r709368833
##########
File path: src/relay/backend/aot_executor_codegen.cc
##########
@@ -583,8 +583,16 @@ class AOTExecutorCodegen : public MixedModeVisitor {
// performing the preexisting AOT executor code generation phase.
IRModule mod = IRModule::FromExpr(func);
+ backend::FunctionInfo func_info;
+
+ if (memory_plan.defined()) {
+ // TODO(@electriclilies, @jroesch): remove UpdateMainWorkspaceSize
+ func_info = tec::UpdateMainWorkspaceSize(mod, targets_,
memory_plan->expr_to_storage_info);
+ mod = WithAttr(mod, "main_func_info", func_info);
+ }
Review comment:
Can we condense this to:
```suggestion
if (memory_plan.defined()) {
// TODO(@electriclilies, @jroesch): remove UpdateMainWorkspaceSize
backend::FunctionInfo func_info = tec::UpdateMainWorkspaceSize(mod,
targets_, memory_plan->expr_to_storage_info);
mod = WithAttr(mod, "main_func_info", func_info);
}
```
##########
File path: src/relay/backend/graph_executor_codegen.cc
##########
@@ -221,8 +221,17 @@ class GraphExecutorCodegen : public
backend::MemoizedExprTranslator<std::vector<
device_context_map.insert({expr, dev});
}
+ backend::FunctionInfo func_info;
+
+ if (memory_plan_.defined()) {
+ // TODO(@electriclilies, @jroesch): remove UpdateMainWorkspaceSize
+ func_info =
+ relay::tec::UpdateMainWorkspaceSize(mod, targets_,
memory_plan_->expr_to_storage_info);
+ mod = WithAttr(mod, "main_func_info", func_info);
+ }
+
Review comment:
As above:
```suggestion
if (memory_plan_.defined()) {
// TODO(@electriclilies, @jroesch): remove UpdateMainWorkspaceSize
backend::FunctionInfo func_info =
relay::tec::UpdateMainWorkspaceSize(mod, targets_,
memory_plan_->expr_to_storage_info);
mod = WithAttr(mod, "main_func_info", func_info);
}
```
--
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]