tkonolige commented on a change in pull request #7746:
URL: https://github.com/apache/tvm/pull/7746#discussion_r602411072



##########
File path: src/runtime/library_module.cc
##########
@@ -99,6 +99,29 @@ void InitContextFunctions(std::function<void*(const char*)> 
fgetsymbol) {
 #undef TVM_INIT_CONTEXT_FUNC
 }
 
+Module LoadModuleFromBinary(const std::string& type_key, dmlc::Stream* stream) 
{
+  std::string loadkey = "runtime.module.loadbinary_";
+  std::string fkey = loadkey + type_key;
+  const PackedFunc* f = Registry::Get(fkey);
+  if (f == nullptr) {
+    std::string loaders = "";
+    for (auto name : Registry::ListNames()) {
+      if (name.rfind(loadkey, 0) == 0) {
+        if (loaders.size() > 0) {
+          loaders += ", ";
+        }
+        loaders += name.substr(loadkey.size());
+      }
+    }
+    ICHECK(f != nullptr)

Review comment:
       `ICHECK_NOTNULL(f)` or `LOG(FATAL)`

##########
File path: src/runtime/library_module.cc
##########
@@ -99,6 +99,28 @@ void InitContextFunctions(std::function<void*(const char*)> 
fgetsymbol) {
 #undef TVM_INIT_CONTEXT_FUNC
 }
 
+Module LoadModuleFromBinary(const std::string& type_key, dmlc::Stream* stream) 
{
+  std::string loadkey = "runtime.module.loadbinary_";
+  std::string fkey = loadkey + type_key;
+  const PackedFunc* f = Registry::Get(fkey);
+  if (f == nullptr) {
+    std::string loaders = "";
+    for (auto name : Registry::ListNames()) {
+      if (name.rfind(loadkey, 0) == 0) {
+        if (loaders.size() > 0) {
+          loaders += ", ";
+        }
+        loaders += name.substr(loadkey.size());
+      }
+    }
+    ICHECK(f != nullptr) << "Binary was created using " << type_key

Review comment:
       `ICHECK_NOTNULL` or `LOG(FATAL)`

##########
File path: src/runtime/library_module.cc
##########
@@ -99,6 +99,29 @@ void InitContextFunctions(std::function<void*(const char*)> 
fgetsymbol) {
 #undef TVM_INIT_CONTEXT_FUNC
 }
 
+Module LoadModuleFromBinary(const std::string& type_key, dmlc::Stream* stream) 
{
+  std::string loadkey = "runtime.module.loadbinary_";
+  std::string fkey = loadkey + type_key;
+  const PackedFunc* f = Registry::Get(fkey);
+  if (f == nullptr) {
+    std::string loaders = "";
+    for (auto name : Registry::ListNames()) {
+      if (name.rfind(loadkey, 0) == 0) {

Review comment:
       ```suggestion
         if (name.find(loadkey, 0) == 0) {
   ```
   
   Assuming you want the string to start with "runtime.module.loadbinary_".




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