You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/02/16 03:43:31 UTC

[GitHub] [tvm] liangfu commented on a change in pull request #7406: [BYOC][Verilator] Refactor Verilator runtime

liangfu commented on a change in pull request #7406:
URL: https://github.com/apache/tvm/pull/7406#discussion_r576530859



##########
File path: src/runtime/contrib/verilator/verilator_runtime.cc
##########
@@ -76,19 +76,24 @@ VerilatorProfiler* VerilatorProfiler::ThreadLocal() {
   return &inst;
 }
 
-void VerilatorRuntime::LoadLibrary(const std::string& lib_name) {
-  lib_ = new VerilatorLibrary();
-  lib_->Load(lib_name);
+VerilatorRuntime::~VerilatorRuntime() {
+  auto dealloc = reinterpret_cast<VerilatorDeallocFunc>(lib_->GetSymbol("VerilatorDealloc"));
+  ICHECK(dealloc != nullptr);
+  dealloc(device_);
+  lib_->~VerilatorLibrary();

Review comment:
       just out of curiosity, why do we explicitly call the deallocator instead of `delete lib_`?




----------------------------------------------------------------
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:
users@infra.apache.org