xqdan commented on a change in pull request #8079:
URL: https://github.com/apache/tvm/pull/8079#discussion_r638626298



##########
File path: src/ir/op.cc
##########
@@ -102,10 +102,61 @@ 
TVM_REGISTER_GLOBAL("ir.OpResetAttr").set_body_typed([](Op op, String attr_name)
   reg.reset_attr(attr_name);
 });
 
-TVM_REGISTER_GLOBAL("ir.RegisterOp").set_body_typed([](String op_name) {
-  const OpRegEntry* reg = OpRegistry::Global()->Get(op_name);
-  ICHECK(reg == nullptr) << "AttributeError: Operator " << op_name << " is 
registered before";
-  OpRegistry::Global()->RegisterOrGet(op_name).set_name();
+TVM_REGISTER_GLOBAL("ir.RegisterOp").set_body_typed([](String op_name, String 
descr) {
+  auto& reg = OpRegistry::Global()->RegisterOrGet(op_name).set_name();
+  reg.describe(descr);
+});
+
+TVM_REGISTER_GLOBAL("ir.OpAddTypeRel")
+    .set_body_typed([](Op op, String rel_name, runtime::TVMArgValue value) {
+      auto& reg = OpRegistry::Global()->RegisterOrGet(op->name).set_name();
+      if (value.type_code() == kTVMPackedFuncHandle) {
+        // do an eager copy of the PackedFunc to avoid deleting function from 
frontend.
+        PackedFunc* fcopy = new PackedFunc(value.operator 
tvm::runtime::PackedFunc());

Review comment:
       done




-- 
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:
[email protected]


Reply via email to