areusch commented on a change in pull request #6917:
URL: https://github.com/apache/incubator-tvm/pull/6917#discussion_r528402290



##########
File path: src/runtime/graph/graph_runtime.cc
##########
@@ -244,6 +249,39 @@ void GraphRuntime::ShareParams(const GraphRuntime& other, 
dmlc::Stream* strm) {
   this->SetupOpExecs();
 }
 
+void GraphRuntime::PreAllocatedDLTensorDeleter(DLManagedTensor* tensor) {

Review comment:
       ah you are right! changed.

##########
File path: src/runtime/graph/graph_runtime.cc
##########
@@ -244,6 +249,39 @@ void GraphRuntime::ShareParams(const GraphRuntime& other, 
dmlc::Stream* strm) {
   this->SetupOpExecs();
 }
 
+void GraphRuntime::PreAllocatedDLTensorDeleter(DLManagedTensor* tensor) {
+  // ctx is the DLTensor which needs to get deleted. The data member points to 
global const memory.
+  delete reinterpret_cast<DLTensor*>(tensor);
+}
+
+void GraphRuntime::DefaultLookupLinkedParam(TVMArgs args, TVMRetValue* rv) {
+  Module mod = args[0];
+  int64_t storage_id = args[1];
+  DLTensor* template_tensor = args[2];
+  TVMContext ctx = args[3];
+  // Get pre-linked parameter lookup function, if it was generated. When pf == 
nullptr, no linked
+  // params are present.
+  tvm::runtime::PackedFunc pf =
+      mod.GetFunction(::tvm::runtime::symbol::tvm_lookup_linked_param, true);
+  if (pf == nullptr) {
+    *rv = nullptr;
+    return;
+  }
+
+  TVMRetValue opaque_handle = pf(storage_id);
+  if (opaque_handle.type_code() == kTVMNullptr) {
+    *rv = nullptr;
+    return;
+  }
+
+  std::vector<int64_t> shape_vec{template_tensor->shape,
+                                 template_tensor->shape + 
template_tensor->ndim};
+
+  std::unique_ptr<NDArray::Container> container{new NDArray::Container(

Review comment:
       done




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


Reply via email to