You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by lu...@apache.org on 2022/12/21 17:39:35 UTC

[tvm] branch main updated: [ETHOSN] Fix for the mock inference after NPU driver update (#13650)

This is an automated email from the ASF dual-hosted git repository.

lukhut pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new 36d89a28fb [ETHOSN] Fix for the mock inference after NPU driver update (#13650)
36d89a28fb is described below

commit 36d89a28fb984caa83082b034c46180a82dcd1ea
Author: Ashutosh Parkhi <86...@users.noreply.github.com>
AuthorDate: Wed Dec 21 17:39:28 2022 +0000

    [ETHOSN] Fix for the mock inference after NPU driver update (#13650)
    
    NPU driver 22.11 supports buffer and network creation
    with only process memory allocator. This change however
    should be limited to the cases when the HW is available.
    
    NPU driver update: #13637
---
 src/runtime/contrib/ethosn/ethosn_device.cc  | 2 +-
 src/runtime/contrib/ethosn/ethosn_runtime.cc | 4 +---
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/runtime/contrib/ethosn/ethosn_device.cc b/src/runtime/contrib/ethosn/ethosn_device.cc
index 7e16f7e887..d4ebec4de3 100644
--- a/src/runtime/contrib/ethosn/ethosn_device.cc
+++ b/src/runtime/contrib/ethosn/ethosn_device.cc
@@ -272,7 +272,7 @@ TVM_REGISTER_GLOBAL("relay.ethos-n.test.infra.inference_result")
 // Allow the ethos-n support code to be tested without a device
 bool Inference(tvm::runtime::TVMArgs args,
 #ifdef _ETHOSN_API_VERSION_3_2_0
-               dl::ProcMemAllocator* proc_mem_alloc,
+               dl::ProcMemAllocator* /*proc_mem_alloc*/,
 #endif
                dl::Network* /* npu */, const std::vector<uint32_t>& input_order,
                const std::vector<uint32_t>& output_order, const std::vector<uint32_t>& input_sizes,
diff --git a/src/runtime/contrib/ethosn/ethosn_runtime.cc b/src/runtime/contrib/ethosn/ethosn_runtime.cc
index 11edc8c71a..0b68db1a17 100644
--- a/src/runtime/contrib/ethosn/ethosn_runtime.cc
+++ b/src/runtime/contrib/ethosn/ethosn_runtime.cc
@@ -114,9 +114,6 @@ Module EthosnModule::LoadFromBinary(void* strm) {
   cmms.resize(func_count);
   for (unsigned int i = 0; i < func_count; i++) {
     OrderedCompiledNetwork& compiled = cmms[i];
-#ifdef _ETHOSN_API_VERSION_3_2_0
-    compiled.proc_mem_alloc = std::make_unique<dl::ProcMemAllocator>();
-#endif
     std::string ext_symbol;
     std::string cmm;
     uint64_t input_size;
@@ -130,6 +127,7 @@ Module EthosnModule::LoadFromBinary(void* strm) {
     // If hardware unavaiable use the mock inference functionality. If hardware is
     // avaiable, deserialize the compiled graph.
 #ifdef _ETHOSN_API_VERSION_3_2_0
+    compiled.proc_mem_alloc = std::make_unique<dl::ProcMemAllocator>();
     compiled.runtime_cmm = std::make_unique<dl::Network>(
         compiled.proc_mem_alloc->CreateNetwork(cmm.c_str(), cmm.size()));
 #else