aboutsummaryrefslogtreecommitdiff
path: root/tests/ExecuteNetwork
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ExecuteNetwork')
-rw-r--r--tests/ExecuteNetwork/ArmNNExecutor.cpp7
-rw-r--r--tests/ExecuteNetwork/ArmNNExecutor.hpp14
-rw-r--r--tests/ExecuteNetwork/TfliteExecutor.cpp2
3 files changed, 18 insertions, 5 deletions
diff --git a/tests/ExecuteNetwork/ArmNNExecutor.cpp b/tests/ExecuteNetwork/ArmNNExecutor.cpp
index 139da5f830..730c072836 100644
--- a/tests/ExecuteNetwork/ArmNNExecutor.cpp
+++ b/tests/ExecuteNetwork/ArmNNExecutor.cpp
@@ -19,7 +19,10 @@ ArmNNExecutor::ArmNNExecutor(const ExecuteNetworkParams& params, armnn::IRuntime
{
runtimeOptions.m_EnableGpuProfiling = params.m_EnableProfiling;
runtimeOptions.m_DynamicBackendsPath = params.m_DynamicBackendsPath;
- m_Runtime = armnn::IRuntime::Create(runtimeOptions);
+
+ // Create/Get the static ArmNN Runtime. Note that the m_Runtime will be shared by all ArmNNExecutor
+ // instances so the RuntimeOptions cannot be altered for different ArmNNExecutor instances.
+ m_Runtime = GetRuntime(runtimeOptions);
auto parser = CreateParser();
auto network = parser->CreateNetwork(m_Params);
@@ -100,7 +103,7 @@ void ArmNNExecutor::ExecuteAsync()
}
threadpool = std::make_unique<armnn::Threadpool>(m_Params.m_ThreadPoolSize,
- m_Runtime.get(),
+ m_Runtime,
memHandles);
ARMNN_LOG(info) << "Asynchronous Execution with Arm NN thread pool... \n";
diff --git a/tests/ExecuteNetwork/ArmNNExecutor.hpp b/tests/ExecuteNetwork/ArmNNExecutor.hpp
index c4adc9e120..b0b29deffd 100644
--- a/tests/ExecuteNetwork/ArmNNExecutor.hpp
+++ b/tests/ExecuteNetwork/ArmNNExecutor.hpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
@@ -45,6 +45,16 @@ public:
private:
+ /**
+ * Returns a pointer to the armnn::IRuntime* this will be shared by all ArmNNExecutors.
+ */
+ armnn::IRuntime* GetRuntime(const armnn::IRuntime::CreationOptions& options)
+ {
+ static armnn::IRuntimePtr instance = armnn::IRuntime::Create(options);
+ // Instantiated on first use.
+ return instance.get();
+ }
+
struct IParser;
struct IOInfo;
struct IOStorage;
@@ -101,7 +111,7 @@ private:
std::vector<armnn::OutputTensors> m_OutputTensorsVec;
std::vector<std::vector<unsigned int>> m_ImportedInputIds;
std::vector<std::vector<unsigned int>> m_ImportedOutputIds;
- std::shared_ptr<armnn::IRuntime> m_Runtime;
+ armnn::IRuntime* m_Runtime;
armnn::NetworkId m_NetworkId;
ExecuteNetworkParams m_Params;
diff --git a/tests/ExecuteNetwork/TfliteExecutor.cpp b/tests/ExecuteNetwork/TfliteExecutor.cpp
index 41716ffb93..6a799548bf 100644
--- a/tests/ExecuteNetwork/TfliteExecutor.cpp
+++ b/tests/ExecuteNetwork/TfliteExecutor.cpp
@@ -1,5 +1,5 @@
//
-// Copyright © 2022 Arm Ltd and Contributors. All rights reserved.
+// Copyright © 2022-2023 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//