electriclilies commented on a change in pull request #9312:
URL: https://github.com/apache/tvm/pull/9312#discussion_r733151779



##########
File path: src/relay/op/vm/vm.cc
##########
@@ -195,6 +195,46 @@ RELAY_REGISTER_OP("vm.invoke_tvm_op")
                              return {topi::identity(inputs[0])};
                            });
 
+// call_lowered
+bool CallTIRRel(const Array<Type>& types, int num_inputs, const Attrs& attrs,
+                    const TypeReporter& reporter) {
+  // Types = [func, args, ret_type]
+  ICHECK_EQ(types.size(), 3u);
+  auto func_type = types[0].as<FuncTypeNode>();
+  ICHECK(func_type != nullptr) << "input must be operator with known type";
+  auto input_type = types[1].as<TupleTypeNode>();
+  ICHECK(input_type != nullptr)
+      << "internal invariant violated: call_lowered inputs must be a tuple";
+  reporter->Assign(types[2], func_type->ret_type);
+  return true;
+}
+
+Expr CallTIR(Expr func, Expr inputs, Attrs attrs) {
+  ICHECK(func.as<GlobalVarNode>()) << "Function to call should be 
GlobalVarNode, but got " << func->GetTypeKey();
+  return Call(Op::Get("call_lowered"), {func, inputs}, attrs);
+}
+
+TVM_REGISTER_GLOBAL("relay.op.call_lowered").set_body_typed(CallTIR);
+
+RELAY_REGISTER_OP("call_lowered")
+    .describe(R"code(Invoke an operation compiled by TVM.)code" 
TVM_ADD_FILELINE)
+    .set_num_inputs(2)
+    .add_argument("op", "Function", "The operation to call")
+    .add_argument("ins", "Tuple", "The input tensors.")
+    .add_type_rel("CallTIRRel", CallTIRRel)
+    .set_support_level(10)
+    .set_attr<TOpPattern>("TOpPattern", kOpaque)

Review comment:
       I made a separate PR to remove all the FTVMCompute from noncomputational 
ops, will remove from call_lowered though: 
https://github.com/apache/tvm/pull/9334




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