Skip to content

Commit

Permalink
[ETHOSN] Fix for the mock inference after NPU driver update (apache#1…
Browse files Browse the repository at this point in the history
…3650)

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: apache#13637
  • Loading branch information
ashutosh-arm authored and fzi-peccia committed Mar 27, 2023
1 parent 9b0de0a commit 323ec09
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/runtime/contrib/ethosn/ethosn_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions src/runtime/contrib/ethosn/ethosn_runtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 323ec09

Please sign in to comment.