lhutton1 commented on a change in pull request #5770:
URL: https://github.com/apache/incubator-tvm/pull/5770#discussion_r440167425



##########
File path: python/tvm/runtime/module.py
##########
@@ -222,21 +222,29 @@ def evaluator(*args):
         except NameError:
             raise NameError("time_evaluate is only supported when RPC is 
enabled")
 
-    def _collect_dso_modules(self):
-        """Helper function to collect dso modules, then return it."""
-        visited, stack, dso_modules = set(), [], []
+    def _collect_dso_metadata_modules(self):
+        """
+        Helper function to collect dso modules and metadata init module. There
+        is at most one medata init module if it exists.

Review comment:
       *metadata

##########
File path: python/tvm/runtime/module.py
##########
@@ -222,21 +222,29 @@ def evaluator(*args):
         except NameError:
             raise NameError("time_evaluate is only supported when RPC is 
enabled")
 
-    def _collect_dso_modules(self):
-        """Helper function to collect dso modules, then return it."""
-        visited, stack, dso_modules = set(), [], []
+    def _collect_dso_metadata_modules(self):
+        """
+        Helper function to collect dso modules and metadata init module. There
+        is at most one medata init module if it exists.
+        """
+        visited, stack, dso_modules, metadata_init = set(), [], [], None
         # append root module
         visited.add(self)
         stack.append(self)
         while stack:
             module = stack.pop()
             if module._dso_exportable():
                 dso_modules.append(module)
+            elif module.type_key == "module_init":
+                assert not metadata_init, \
+                        "At most one module initializer is allowed"

Review comment:
       How does this interact in the case of multiple backends that require the 
use of metadata module? For example it may be the case in the future that we 
want to specify something like: DNNL (first priority), then C-Codegen (second 
priority), then TVM (fallback). If only one metadata module is allowed, would 
this contain information for both DNNL and C-Codegen?




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