Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Followup from #9312 (Introduce call_lowered op) #9491

Merged
merged 2 commits into from
Nov 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/relay/backend/te_compiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -600,15 +600,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.
Expand All @@ -623,10 +623,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);
Expand Down
3 changes: 1 addition & 2 deletions src/relay/op/call/call.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down