You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by ma...@apache.org on 2021/11/13 20:15:15 UTC

[tvm] branch main updated: Followup from #9312 (Introduce call_lowered op) (#9491)

This is an automated email from the ASF dual-hosted git repository.

masahi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new e4904c6  Followup from #9312 (Introduce call_lowered op) (#9491)
e4904c6 is described below

commit e4904c6693cbb338ae9a49e48997b77caee55b78
Author: Lily Orth-Smith <li...@gmail.com>
AuthorDate: Sat Nov 13 12:14:40 2021 -0800

    Followup from #9312 (Introduce call_lowered op) (#9491)
    
    * followups from #9312
    
    * remove unneeded moves
---
 src/relay/backend/te_compiler.cc | 11 ++++-------
 src/relay/op/call/call.cc        |  3 +--
 2 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/src/relay/backend/te_compiler.cc b/src/relay/backend/te_compiler.cc
index 69e6be6..328e970 100644
--- a/src/relay/backend/te_compiler.cc
+++ b/src/relay/backend/te_compiler.cc
@@ -607,15 +607,15 @@ class LowerTensorExprMutator : public DeviceAwareExprMutator {
     }
 
     // Similarly transform arguments.
-    Array<Expr> args;
+    Array<Expr> visited_args;
     for (const auto& arg : call_node->args) {
-      args.push_back(VisitExpr(arg));
+      visited_args.push_back(VisitExpr(arg));
     }
 
     // Already lowered by other means so we don't need to mutate
     // the call but we do need to mutate the arguments
     if (prim_func->IsInstance<tir::PrimFuncNode>()) {
-      return Call(call_node->op, args, call_node->attrs);
+      return Call(call_node->op, visited_args, call_node->attrs);
     }
 
     // Find the desired target device.
@@ -630,10 +630,7 @@ class LowerTensorExprMutator : public DeviceAwareExprMutator {
       target = se_scope->target;
       ICHECK(target.defined());
     }
-    Array<Expr> visited_args;
-    for (const auto& arg : call_node->args) {
-      visited_args.push_back(VisitExpr(arg));
-    }
+
     // Lower the primitive function for that target.
     Function func = Downcast<Function>(prim_func);
     return MakeLoweredCall(func, visited_args, call_node->type_args, call_node->span, target);
diff --git a/src/relay/op/call/call.cc b/src/relay/op/call/call.cc
index 9485b72..87f18e8 100644
--- a/src/relay/op/call/call.cc
+++ b/src/relay/op/call/call.cc
@@ -108,8 +108,7 @@ CallLoweredProps GetCallLoweredProps(const CallNode* call_node) {
   const auto* attrs = call_node->attrs.as<CallLoweredAttrs>();
   ICHECK(attrs) << "Expected call_lowered op to have CallLoweredAttrs, but found "
                 << call_node->attrs->GetTypeKey();
-  return CallLoweredProps{std::move(GetRef<GlobalVar>(function)), std::move(tuple_args->fields),
-                          std::move(*attrs)};
+  return CallLoweredProps{GetRef<GlobalVar>(function), tuple_args->fields, *attrs};
 }
 
 }  // namespace relay