From 8dc56289c8f6acddbbd17a7a77b06d333369a7f8 Mon Sep 17 00:00:00 2001 From: Finn Williams Date: Wed, 30 Mar 2022 12:09:47 +0100 Subject: IVGCVSW-6754 Integrate Import Host Memory to arm-armnn-sl Signed-off-by: Finn Williams Change-Id: I1d465725e56f61034cb2425157bb594b4ceab9fa --- include/armnn/IRuntime.hpp | 6 ++---- shim/sl/canonical/ArmnnPreparedModel.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/armnn/IRuntime.hpp b/include/armnn/IRuntime.hpp index 042271fc2b..7cd7efda3d 100644 --- a/include/armnn/IRuntime.hpp +++ b/include/armnn/IRuntime.hpp @@ -219,25 +219,23 @@ public: /// ImportInputs separates the importing and mapping of InputTensors from network execution. /// Allowing for a set of InputTensors to be imported and mapped once, but used in execution many times. /// This function is not thread safe and must not be used while other threads are calling Execute(). - /// Only compatible with AsyncEnabled networks and aligned memory import + /// Only compatible with aligned memory import std::vector ImportInputs(NetworkId networkId, const InputTensors& inputTensors, MemorySource forceImportMemorySource = MemorySource::Undefined); /// ImportOutputs separates the importing and mapping of OutputTensors from network execution. /// Allowing for a set of OutputTensors to be imported and mapped once, but used in execution many times. /// This function is not thread safe and must not be used while other threads are calling Execute(). - /// Only compatible with AsyncEnabled networks and aligned memory import + /// Only compatible with aligned memory import std::vector ImportOutputs(NetworkId networkId, const OutputTensors& outputTensors, MemorySource forceImportMemorySource = MemorySource::Undefined); /// Un-import and delete the imported InputTensor/s /// This function is not thread safe and must not be used while other threads are calling Execute(). - /// Only compatible with AsyncEnabled networks void ClearImportedInputs(NetworkId networkId, const std::vector inputIds); /// Un-import and delete the imported OutputTensor/s /// This function is not thread safe and must not be used while other threads are calling Execute(). - /// Only compatible with AsyncEnabled networks void ClearImportedOutputs(NetworkId networkId, const std::vector outputIds); /// Evaluates a network using input in inputTensors and outputs filled into outputTensors diff --git a/shim/sl/canonical/ArmnnPreparedModel.cpp b/shim/sl/canonical/ArmnnPreparedModel.cpp index 94809497d1..35edfb7d99 100644 --- a/shim/sl/canonical/ArmnnPreparedModel.cpp +++ b/shim/sl/canonical/ArmnnPreparedModel.cpp @@ -385,7 +385,15 @@ ErrorStatus ArmnnPreparedModel::ExecuteGraph( } armnn::Status status; VLOG(DRIVER) << "ArmnnPreparedModel::ExecuteGraph m_AsyncModelExecutionEnabled false"; - status = m_Runtime->EnqueueWorkload(m_NetworkId, inputTensors, outputTensors); + + std::vector importedInputIds; + importedInputIds = m_Runtime->ImportInputs(m_NetworkId, inputTensors, armnn::MemorySource::Malloc); + + std::vector importedOutputIds; + importedOutputIds = m_Runtime->ImportOutputs(m_NetworkId, outputTensors, armnn::MemorySource::Malloc); + + status = m_Runtime->EnqueueWorkload(m_NetworkId, inputTensors, outputTensors, + importedInputIds, importedOutputIds); if (ctx.measureTimings == MeasureTiming::YES) { -- cgit v1.2.1