kparzysz-quic commented on code in PR #12066:
URL: https://github.com/apache/tvm/pull/12066#discussion_r931452130


##########
src/relay/backend/graph_executor_codegen.cc:
##########
@@ -645,8 +629,8 @@ class GraphExecutorCodegen : public 
backend::MemoizedExprTranslator<std::vector<
   String mod_name_;
   /*! \brief function metadata */
   Map<String, FunctionInfo> function_metadata_;
-  /*! \brief name map */
-  std::unordered_map<std::string, size_t> name_map_;
+  /*! \brief NameSupply */
+  NameSupply name_supply_ = NameSupply("");

Review Comment:
   Maybe you could add a default constructor to `NameSupply`, or give the 
prefix a default value, so that you don't have to write `= NameSupply("")`, 
since that occurs in a few places.



##########
src/relay/backend/te_compiler.cc:
##########
@@ -134,30 +135,38 @@ TVM_REGISTER_OBJECT_TYPE(TECompilerNode);
 
 class TECompilerImpl : public TECompilerNode {
  public:
-  explicit TECompilerImpl(Optional<IRModule> opt_mod) {
+  explicit TECompilerImpl(Optional<IRModule> opt_mod, Optional<String> 
opt_mod_name) {
+    String mod_name;
+    if (!opt_mod_name) {
+      mod_name = "";
+    } else {
+      mod_name = opt_mod_name.value();
+    }

Review Comment:
   `String mod_name = opt_mod_name.value_or("");`



##########
src/relay/backend/te_compiler.cc:
##########
@@ -527,8 +526,8 @@ class TECompilerImpl : public TECompilerNode {
 
   /*! \brief compiler cache lock*/
   std::mutex mutex_;
-  /*! \brief internal name map to get an unique name */
-  std::unordered_map<std::string, int> name_map_;
+  /*! \brief internal GlobalVarSupply to get unique GlobalVars  */
+  GlobalVarSupply global_var_supply = GlobalVarSupply();

Review Comment:
   Please just leave it as `GlobalVarSupply global_var_supply;`.  Also, add `_` 
to the name (as with other members).



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