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_1_2.hpp | 46 +++++++++++++--------------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) (limited to 'ArmnnPreparedModel_1_2.hpp') diff --git a/ArmnnPreparedModel_1_2.hpp b/ArmnnPreparedModel_1_2.hpp index 6c630c56..4ee2b817 100644 --- a/ArmnnPreparedModel_1_2.hpp +++ b/ArmnnPreparedModel_1_2.hpp @@ -12,6 +12,7 @@ #include #include +#include #include #include @@ -45,7 +46,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_1_2(); @@ -98,28 +100,6 @@ private: void Notify(armnn::Status status, armnn::InferenceTimingPair timeTaken) override; - // Retrieve the Arm NN 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_1_2* m_Model; std::shared_ptr> m_MemPools; std::vector m_OutputShapes; @@ -161,20 +141,20 @@ private: std::shared_ptr& outputTensors, CallbackContext m_CallbackContext); - armnn::NetworkId m_NetworkId; - armnn::IRuntime* m_Runtime; - V1_2::Model m_Model; + armnn::NetworkId m_NetworkId; + armnn::IRuntime* m_Runtime; + std::unique_ptr m_Threadpool; + V1_2::Model 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; - uint32_t m_RequestCount; - const std::string& m_RequestInputsAndOutputsDumpDir; - const bool m_GpuProfilingEnabled; - - std::unique_ptr m_WorkingMemHandle; - const bool m_AsyncModelExecutionEnabled; + CallbackContext_1_2> m_RequestThread; + uint32_t m_RequestCount; + const std::string& m_RequestInputsAndOutputsDumpDir; + const bool m_GpuProfilingEnabled; + std::shared_ptr m_WorkingMemHandle; + const bool m_AsyncModelExecutionEnabled; }; } -- cgit v1.2.1