From ca3a3e0fd86a07de9e073ba31dc2b42d6ca84536 Mon Sep 17 00:00:00 2001 From: Finn Williams Date: Fri, 11 Jun 2021 15:04:02 +0100 Subject: IVGCVSW-6062 Rework the async threadpool !armnn:5801 Signed-off-by: Finn Williams Change-Id: I9964d0899ce752441f380edddbd974010257b2dd --- ArmnnPreparedModel.hpp | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) (limited to 'ArmnnPreparedModel.hpp') diff --git a/ArmnnPreparedModel.hpp b/ArmnnPreparedModel.hpp index d1c830d4..58177d92 100644 --- a/ArmnnPreparedModel.hpp +++ b/ArmnnPreparedModel.hpp @@ -11,6 +11,7 @@ #include #include +#include #include #include @@ -39,7 +40,8 @@ public: const HalModel& model, const std::string& requestInputsAndOutputsDumpDir, const bool gpuProfilingEnabled, - const bool asyncModelExecutionEnabled = false); + const bool asyncModelExecutionEnabled = false, + const unsigned int numberOfThreads = 1); virtual ~ArmnnPreparedModel(); @@ -76,28 +78,6 @@ private: void Notify(armnn::Status status, armnn::InferenceTimingPair timeTaken) override; - // Retrieve the ArmNN Status from the AsyncExecutionCallback that has been notified - virtual armnn::Status GetStatus() const override - { - return armnn::Status::Success; - } - - // Block the calling thread until the AsyncExecutionCallback object allows it to proceed - virtual void Wait() const override - {} - - // Retrieve the start time before executing the inference - virtual armnn::HighResolutionClock GetStartTime() const override - { - return std::chrono::high_resolution_clock::now(); - } - - // Retrieve the time after executing the inference - virtual armnn::HighResolutionClock GetEndTime() const override - { - return std::chrono::high_resolution_clock::now(); - } - ArmnnPreparedModel* m_Model; std::shared_ptr> m_MemPools; std::shared_ptr m_InputTensors; @@ -116,9 +96,10 @@ private: std::shared_ptr& outputTensors, CallbackContext m_CallbackContext); - armnn::NetworkId m_NetworkId; - armnn::IRuntime* m_Runtime; - HalModel m_Model; + armnn::NetworkId m_NetworkId; + armnn::IRuntime* m_Runtime; + std::unique_ptr m_Threadpool; + HalModel m_Model; // There must be a single RequestThread for all ArmnnPreparedModel objects to ensure serial execution of workloads // It is specific to this class, so it is declared as static here static RequestThread m_RequestThread; @@ -126,7 +107,7 @@ private: const std::string& m_RequestInputsAndOutputsDumpDir; const bool m_GpuProfilingEnabled; - std::unique_ptr m_WorkingMemHandle; + std::shared_ptr m_WorkingMemHandle; const bool m_AsyncModelExecutionEnabled; }; -- cgit v1.2.1