areusch commented on a change in pull request #8014:
URL: https://github.com/apache/tvm/pull/8014#discussion_r645727270



##########
File path: src/relay/transforms/partition_graph.cc
##########
@@ -480,11 +480,77 @@ IRModule FlattenTupleOutputs(IRModule module) {
   return module;
 }
 
+class NameMangleExtFuncs : public MixedModeMutator {
+ public:
+  explicit NameMangleExtFuncs(const IRModule& module, 
std::function<String(String)> mangle_fn)
+      : module_(module), mangle_fn_(mangle_fn) {}
+
+  IRModule Run() {
+    auto glob_funcs = module_->functions;
+
+    // Collect function names to be mangled and create
+    // global mangled variables
+    for (const auto& pair : glob_funcs) {
+      if (auto* fn = pair.second.as<FunctionNode>()) {
+        auto func = GetRef<Function>(fn);
+        if (func->GetAttr<String>(attr::kCompiler).defined()) {
+          auto fn_name_mangled = mangle_fn_(pair.first->name_hint);
+          GlobalVar gvar = GlobalVar(fn_name_mangled);
+          mangled_gvars_[pair.first->name_hint] = gvar;
+        }
+      }
+    }
+
+    // Walk the three and mangle the functions. Then replace compiler functions

Review comment:
       nit: s/three/tree/ i think




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