Repository: mlc-ai/mlc-llm
File: cpp/serve/function_table.cc (C++)

Code before:
    this->mod_get_func = [this,
                          fmodule_get_function = sess->GetGlobalFunc("runtime.ModuleGetFunction")](
                             const std::string& name) -> PackedFunc {
      DRef func = sess->CallPacked(fmodule_get_function, this->disco_mod, name, false);
      bool exists = (func->DebugGetFromRemote(0).operator PackedFunc()) != nullptr;
      if (!exists) {
        return PackedFunc(nullptr);
      }
      return SessionFuncAsPackedFunc(sess, func, name);
    };
    if (Optional<IntTuple> cpu_ids = GetDiscoWorkerCPUBinding(/*num_workers=*/num_shards)) {
      IntTuple cpu_ids_value = cpu_ids.value();
      sess->CallPacked(sess->GetGlobalFunc("runtime.disco.bind_worker_to_cpu_core"), cpu_ids_value);
    }
    this->get_global_func = [this](const std::string& name) -> PackedFunc {
      return SessionFuncAsPackedFunc(sess, sess->GetGlobalFunc(name), name);
    };
    this->model_metadata_ =
        ModelMetadata::FromModule(this->disco_mod->DebugGetFromRemote(0), std::move(model_config));
    this->_InitFunctions();
  } else {
    Module executable{nullptr};
    if (StartsWith(reload_lib_path, "system://")) {
      const PackedFunc* f_load_system_lib = Registry::Get("runtime.SystemLib");
      ICHECK_NOTNULL(f_load_system_lib);
      executable = (*f_load_system_lib)(std::string(reload_lib_path).substr(9));
    } else {
      executable = tvm::runtime::Module::LoadFromFile(reload_lib_path);
    }
    this->use_disco = false;
    auto fload_exec = executable->GetFunction("vm_load_executable");
    ICHECK(fload_exec.defined()) << "TVM runtime cannot find vm_load_executable";
    this->local_vm = fload_exec();
    this->local_vm->GetFunction("vm_initialization")(
        static_cast<int>(device.device_type), device.device_id,
        static_cast<int>(tvm::runtime::memory::AllocatorType::kPooled), static_cast<int>(kDLCPU), 0,
        static_cast<int>(tvm::runtime::memory::AllocatorType::kPooled));
    this->mod_get_func = [this](const std::string& name) -> PackedFunc {
      return this->local_vm->GetFunction(name, false);
    };
    this->get_global_func = [](const std::string& name) -> PackedFunc {
      const auto* f = tvm::runtime::Registry::Get(name);
      CHECK(f != nullptr) << "ValueError: Cannot find function " << name;
      return *f;
    };
    this->model_metadata_ = ModelMetadata::FromModule(this->local_vm, std::move(model_config));
    this->_InitFunctions();
  }
}

ObjectRef FunctionTable::LoadParams(const std::string& model_path, Device device) {

Review comment (suggestion):
```
system_lib_prefix = std::string(reload_lib_path).substr(9)
replace `-` to `_`

add an final `_`
```

Code after:
    this->mod_get_func = [this,
                          fmodule_get_function = sess->GetGlobalFunc("runtime.ModuleGetFunction")](
                             const std::string& name) -> PackedFunc {
      DRef func = sess->CallPacked(fmodule_get_function, this->disco_mod, name, false);
      bool exists = (func->DebugGetFromRemote(0).operator PackedFunc()) != nullptr;
      if (!exists) {
        return PackedFunc(nullptr);
      }
      return SessionFuncAsPackedFunc(sess, func, name);
    };
    if (Optional<IntTuple> cpu_ids = GetDiscoWorkerCPUBinding(/*num_workers=*/num_shards)) {
      IntTuple cpu_ids_value = cpu_ids.value();
      sess->CallPacked(sess->GetGlobalFunc("runtime.disco.bind_worker_to_cpu_core"), cpu_ids_value);
    }
    this->get_global_func = [this](const std::string& name) -> PackedFunc {
      return SessionFuncAsPackedFunc(sess, sess->GetGlobalFunc(name), name);
    };
    this->model_metadata_ =
        ModelMetadata::FromModule(this->disco_mod->DebugGetFromRemote(0), std::move(model_config));
    this->_InitFunctions();
  } else {
    Module executable{nullptr};
    PackedFunc fload_exec{nullptr};
    if (StartsWith(reload_lib_path, "system://")) {
      const PackedFunc* f_load_system_lib = Registry::Get("runtime.SystemLib");
      ICHECK_NOTNULL(f_load_system_lib);
      std::string system_lib_prefix = std::string(reload_lib_path).substr(9);
      std::replace(system_lib_prefix.begin(), system_lib_prefix.end(), /*old=*/'-', /*new=*/'_');
      executable = (*f_load_system_lib)(system_lib_prefix + "_");
      fload_exec = executable->GetFunction("vm_load_executable");
      ICHECK(fload_exec.defined())
          << "Cannot find system lib with " << system_lib_prefix
          << ", please make sure you set model_lib field consistently with the compilation ";
    } else {
      executable = tvm::runtime::Module::LoadFromFile(reload_lib_path);
      fload_exec = executable->GetFunction("vm_load_executable");
      ICHECK(fload_exec.defined()) << "TVM runtime cannot find vm_load_executable";
    }
    this->use_disco = false;
    this->local_vm = fload_exec();
    this->local_vm->GetFunction("vm_initialization")(
        static_cast<int>(device.device_type), device.device_id,
        static_cast<int>(tvm::runtime::memory::AllocatorType::kPooled), static_cast<int>(kDLCPU), 0,
        static_cast<int>(tvm::runtime::memory::AllocatorType::kPooled));
    this->mod_get_func = [this](const std::string& name) -> PackedFunc {
      return this->local_vm->GetFunction(name, false);
    };
    this->get_global_func = [](const std::string& name) -> PackedFunc {
      const auto* f = tvm::runtime::Registry::Get(name);
      CHECK(f != nullptr) << "ValueError: Cannot find function " << name;
      return *f;