From d92a6e4c19567cb03de76963068c002353cea528 Mon Sep 17 00:00:00 2001 From: Kevin May Date: Thu, 4 Feb 2021 10:27:41 +0000 Subject: IVGCVSW-4873 Implement Pimpl Idiom for IRuntime Signed-off-by: Kevin May Change-Id: I52448938735b2aa678c47e0f3061c87fa0c693b1 --- include/armnn/IRuntime.hpp | 41 ++++---- src/armnn/Runtime.cpp | 112 ++++++++++++++++----- src/armnn/Runtime.hpp | 45 ++++----- src/armnn/test/RuntimeTests.cpp | 8 +- src/armnn/test/RuntimeTests.hpp | 2 +- src/armnn/test/TestUtils.cpp | 2 +- src/armnn/test/TestUtils.hpp | 2 +- .../backendsCommon/test/BackendProfilingTests.cpp | 2 +- .../backendsCommon/test/RuntimeTestImpl.hpp | 2 +- src/backends/cl/test/ClRuntimeTests.cpp | 2 +- src/backends/neon/test/NeonRuntimeTests.cpp | 2 +- .../reference/test/RefOptimizedNetworkTests.cpp | 28 +++--- src/backends/reference/test/RefRuntimeTests.cpp | 2 +- src/profiling/FileOnlyProfilingConnection.hpp | 4 +- .../ProfilingConnectionDumpToFileDecorator.cpp | 2 +- .../ProfilingConnectionDumpToFileDecorator.hpp | 12 +-- src/profiling/ProfilingConnectionFactory.cpp | 2 +- .../test/FileOnlyProfilingDecoratorTests.cpp | 8 +- ...ProfilingConnectionDumpToFileDecoratorTests.cpp | 12 +-- src/profiling/test/ProfilingTestUtils.cpp | 2 +- src/profiling/test/ProfilingTests.cpp | 44 ++++---- src/profiling/test/SendTimelinePacketTests.cpp | 2 +- .../profiling/gatordmock/tests/GatordMockTests.cpp | 2 +- 23 files changed, 204 insertions(+), 136 deletions(-) diff --git a/include/armnn/IRuntime.hpp b/include/armnn/IRuntime.hpp index c9a71ca458..4114c9950a 100644 --- a/include/armnn/IRuntime.hpp +++ b/include/armnn/IRuntime.hpp @@ -21,6 +21,7 @@ using NetworkId = int; class IGpuAccTunedParameters; +struct RuntimeImpl; class IRuntime; using IRuntimePtr = std::unique_ptr; @@ -124,7 +125,7 @@ public: /// @param [in] network - Complete network to load into the IRuntime. /// The runtime takes ownership of the network once passed in. /// @return armnn::Status - virtual Status LoadNetwork(NetworkId& networkIdOut, IOptimizedNetworkPtr network) = 0; + Status LoadNetwork(NetworkId& networkIdOut, IOptimizedNetworkPtr network); /// Load a complete network into the IRuntime. /// @param [out] networkIdOut Unique identifier for the network is returned in this reference. @@ -132,44 +133,48 @@ public: /// @param [out] errorMessage Error message if there were any errors. /// The runtime takes ownership of the network once passed in. /// @return armnn::Status - virtual Status LoadNetwork(NetworkId& networkIdOut, - IOptimizedNetworkPtr network, - std::string& errorMessage) = 0; + Status LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr network, + std::string& errorMessage); - virtual Status LoadNetwork(NetworkId& networkIdOut, - IOptimizedNetworkPtr network, - std::string& errorMessage, - const INetworkProperties& networkProperties) = 0; + Status LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr network, + std::string& errorMessage, + const INetworkProperties& networkProperties); - virtual TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const = 0; - virtual TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const = 0; + TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const; + TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const; /// Evaluates a network using input in inputTensors and outputs filled into outputTensors - virtual Status EnqueueWorkload(NetworkId networkId, - const InputTensors& inputTensors, - const OutputTensors& outputTensors) = 0; + Status EnqueueWorkload(NetworkId networkId, + const InputTensors& inputTensors, + const OutputTensors& outputTensors); /// Unloads a network from the IRuntime. /// At the moment this only removes the network from the m_Impl->m_Network. /// This might need more work in the future to be AndroidNN compliant. /// @param [in] networkId - Unique identifier for the network to be unloaded. Generated in LoadNetwork(). /// @return armnn::Status - virtual Status UnloadNetwork(NetworkId networkId) = 0; + Status UnloadNetwork(NetworkId networkId); - virtual const IDeviceSpec& GetDeviceSpec() const = 0; + const IDeviceSpec& GetDeviceSpec() const; /// Gets the profiler corresponding to the given network id. /// @param networkId The id of the network for which to get the profile. /// @return A pointer to the requested profiler, or nullptr if not found. - virtual const std::shared_ptr GetProfiler(NetworkId networkId) const = 0; + const std::shared_ptr GetProfiler(NetworkId networkId) const; /// Registers a callback function to debug layers performing custom computations on intermediate tensors. /// @param networkId The id of the network to register the callback. /// @param func callback function to pass to the debug layer. - virtual void RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction& func) = 0; + void RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction& func); protected: - ~IRuntime() {} + IRuntime(); + IRuntime(const IRuntime::CreationOptions& options); + ~IRuntime(); + + std::unique_ptr pRuntimeImpl; }; diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index aeecbfedc1..8fdc4f1e0a 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -23,10 +23,15 @@ using namespace std; namespace armnn { +IRuntime::IRuntime() : pRuntimeImpl( new RuntimeImpl(armnn::IRuntime::CreationOptions())) {} + +IRuntime::IRuntime(const IRuntime::CreationOptions& options) : pRuntimeImpl(new RuntimeImpl(options)) {} + +IRuntime::~IRuntime() = default; IRuntime* IRuntime::CreateRaw(const CreationOptions& options) { - return new Runtime(options); + return new IRuntime(options); } IRuntimePtr IRuntime::Create(const CreationOptions& options) @@ -36,32 +41,89 @@ IRuntimePtr IRuntime::Create(const CreationOptions& options) void IRuntime::Destroy(IRuntime* runtime) { - delete PolymorphicDowncast(runtime); + delete runtime; +} + +Status IRuntime::LoadNetwork(NetworkId& networkIdOut, IOptimizedNetworkPtr network) +{ + return pRuntimeImpl->LoadNetwork(networkIdOut, std::move(network)); +} + +Status IRuntime::LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr network, + std::string& errorMessage) +{ + return pRuntimeImpl->LoadNetwork(networkIdOut, std::move(network), errorMessage); +} + +Status IRuntime::LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr network, + std::string& errorMessage, + const INetworkProperties& networkProperties) +{ + return pRuntimeImpl->LoadNetwork(networkIdOut, std::move(network), errorMessage, networkProperties); +} + +TensorInfo IRuntime::GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const +{ + return pRuntimeImpl->GetInputTensorInfo(networkId, layerId); +} + +TensorInfo IRuntime::GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const +{ + return pRuntimeImpl->GetOutputTensorInfo(networkId, layerId); +} + +Status IRuntime::EnqueueWorkload(NetworkId networkId, + const InputTensors& inputTensors, + const OutputTensors& outputTensors) +{ + return pRuntimeImpl->EnqueueWorkload(networkId, inputTensors, outputTensors); +} + +Status IRuntime::UnloadNetwork(NetworkId networkId) +{ + return pRuntimeImpl->UnloadNetwork(networkId); +} + +const IDeviceSpec& IRuntime::GetDeviceSpec() const +{ + return pRuntimeImpl->GetDeviceSpec(); +} + +const std::shared_ptr IRuntime::GetProfiler(NetworkId networkId) const +{ + return pRuntimeImpl->GetProfiler(networkId); +} + +void IRuntime::RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction& func) +{ + return pRuntimeImpl->RegisterDebugCallback(networkId, func); } -int Runtime::GenerateNetworkId() +int RuntimeImpl::GenerateNetworkId() { return m_NetworkIdCounter++; } -Status Runtime::LoadNetwork(NetworkId& networkIdOut, IOptimizedNetworkPtr inNetwork) +Status RuntimeImpl::LoadNetwork(NetworkId& networkIdOut, IOptimizedNetworkPtr inNetwork) { std::string ignoredErrorMessage; return LoadNetwork(networkIdOut, std::move(inNetwork), ignoredErrorMessage); } -Status Runtime::LoadNetwork(NetworkId& networkIdOut, - IOptimizedNetworkPtr inNetwork, - std::string& errorMessage) +Status RuntimeImpl::LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr inNetwork, + std::string& errorMessage) { INetworkProperties networkProperties; return LoadNetwork(networkIdOut, std::move(inNetwork), errorMessage, networkProperties); } -Status Runtime::LoadNetwork(NetworkId& networkIdOut, - IOptimizedNetworkPtr inNetwork, - std::string& errorMessage, - const INetworkProperties& networkProperties) +Status RuntimeImpl::LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr inNetwork, + std::string& errorMessage, + const INetworkProperties& networkProperties) { IOptimizedNetwork* rawNetwork = inNetwork.release(); @@ -103,7 +165,7 @@ Status Runtime::LoadNetwork(NetworkId& networkIdOut, return Status::Success; } -Status Runtime::UnloadNetwork(NetworkId networkId) +Status RuntimeImpl::UnloadNetwork(NetworkId networkId) { bool unloadOk = true; for (auto&& context : m_BackendContexts) @@ -113,7 +175,7 @@ Status Runtime::UnloadNetwork(NetworkId networkId) if (!unloadOk) { - ARMNN_LOG(warning) << "Runtime::UnloadNetwork(): failed to unload " + ARMNN_LOG(warning) << "RuntimeImpl::UnloadNetwork(): failed to unload " "network with ID:" << networkId << " because BeforeUnloadNetwork failed"; return Status::Failure; } @@ -136,7 +198,7 @@ Status Runtime::UnloadNetwork(NetworkId networkId) } if (m_LoadedNetworks.erase(networkId) == 0) { - ARMNN_LOG(warning) << "WARNING: Runtime::UnloadNetwork(): " << networkId << " not found!"; + ARMNN_LOG(warning) << "WARNING: RuntimeImpl::UnloadNetwork(): " << networkId << " not found!"; return Status::Failure; } @@ -151,11 +213,11 @@ Status Runtime::UnloadNetwork(NetworkId networkId) context.second->AfterUnloadNetwork(networkId); } - ARMNN_LOG(debug) << "Runtime::UnloadNetwork(): Unloaded network with ID: " << networkId; + ARMNN_LOG(debug) << "RuntimeImpl::UnloadNetwork(): Unloaded network with ID: " << networkId; return Status::Success; } -const std::shared_ptr Runtime::GetProfiler(NetworkId networkId) const +const std::shared_ptr RuntimeImpl::GetProfiler(NetworkId networkId) const { auto it = m_LoadedNetworks.find(networkId); if (it != m_LoadedNetworks.end()) @@ -167,7 +229,7 @@ const std::shared_ptr Runtime::GetProfiler(NetworkId networkId) const return nullptr; } -void Runtime::ReportStructure() // armnn::profiling::IProfilingService& profilingService as param +void RuntimeImpl::ReportStructure() // armnn::profiling::IProfilingService& profilingService as param { // No-op for the time being, but this may be useful in future to have the profilingService available // if (profilingService.IsProfilingEnabled()){} @@ -182,7 +244,7 @@ void Runtime::ReportStructure() // armnn::profiling::IProfilingService& profilin } } -Runtime::Runtime(const CreationOptions& options) +RuntimeImpl::RuntimeImpl(const IRuntime::CreationOptions& options) : m_NetworkIdCounter(0), m_ProfilingService(*this) { @@ -251,7 +313,7 @@ Runtime::Runtime(const CreationOptions& options) << std::fixed << armnn::GetTimeDuration(start_time).count() << " ms\n"; } -Runtime::~Runtime() +RuntimeImpl::~RuntimeImpl() { const auto start_time = armnn::GetTimeNow(); std::vector networkIDs; @@ -301,24 +363,24 @@ Runtime::~Runtime() << std::fixed << armnn::GetTimeDuration(start_time).count() << " ms\n"; } -LoadedNetwork* Runtime::GetLoadedNetworkPtr(NetworkId networkId) const +LoadedNetwork* RuntimeImpl::GetLoadedNetworkPtr(NetworkId networkId) const { std::lock_guard lockGuard(m_Mutex); return m_LoadedNetworks.at(networkId).get(); } -TensorInfo Runtime::GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const +TensorInfo RuntimeImpl::GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const { return GetLoadedNetworkPtr(networkId)->GetInputTensorInfo(layerId); } -TensorInfo Runtime::GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const +TensorInfo RuntimeImpl::GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const { return GetLoadedNetworkPtr(networkId)->GetOutputTensorInfo(layerId); } -Status Runtime::EnqueueWorkload(NetworkId networkId, +Status RuntimeImpl::EnqueueWorkload(NetworkId networkId, const InputTensors& inputTensors, const OutputTensors& outputTensors) { @@ -340,13 +402,13 @@ Status Runtime::EnqueueWorkload(NetworkId networkId, return loadedNetwork->EnqueueWorkload(inputTensors, outputTensors); } -void Runtime::RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction& func) +void RuntimeImpl::RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction& func) { LoadedNetwork* loadedNetwork = GetLoadedNetworkPtr(networkId); loadedNetwork->RegisterDebugCallback(func); } -void Runtime::LoadDynamicBackends(const std::string& overrideBackendPath) +void RuntimeImpl::LoadDynamicBackends(const std::string& overrideBackendPath) { // Get the paths where to load the dynamic backends from std::vector backendPaths = DynamicBackendUtils::GetBackendPaths(overrideBackendPath); diff --git a/src/armnn/Runtime.hpp b/src/armnn/Runtime.hpp index 3c90c51bb2..2c7e07f9fb 100644 --- a/src/armnn/Runtime.hpp +++ b/src/armnn/Runtime.hpp @@ -27,8 +27,7 @@ namespace armnn using LoadedNetworks = std::unordered_map>; using IReportStructure = profiling::IReportStructure; -class Runtime final : public IRuntime, - public IReportStructure +struct RuntimeImpl final : public IReportStructure { public: /// Loads a complete network into the Runtime. @@ -36,7 +35,7 @@ public: /// @param [in] network - Complete network to load into the Runtime. /// The runtime takes ownership of the network once passed in. /// @return armnn::Status - virtual Status LoadNetwork(NetworkId& networkIdOut, IOptimizedNetworkPtr network) override; + Status LoadNetwork(NetworkId& networkIdOut, IOptimizedNetworkPtr network); /// Load a complete network into the IRuntime. /// @param [out] networkIdOut Unique identifier for the network is returned in this reference. @@ -44,55 +43,55 @@ public: /// @param [out] errorMessage Error message if there were any errors. /// The runtime takes ownership of the network once passed in. /// @return armnn::Status - virtual Status LoadNetwork(NetworkId& networkIdOut, - IOptimizedNetworkPtr network, - std::string& errorMessage) override; + Status LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr network, + std::string& errorMessage); - virtual Status LoadNetwork(NetworkId& networkIdOut, - IOptimizedNetworkPtr network, - std::string& errorMessage, - const INetworkProperties& networkProperties) override; + Status LoadNetwork(NetworkId& networkIdOut, + IOptimizedNetworkPtr network, + std::string& errorMessage, + const INetworkProperties& networkProperties); - virtual TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const override; - virtual TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const override; + TensorInfo GetInputTensorInfo(NetworkId networkId, LayerBindingId layerId) const; + TensorInfo GetOutputTensorInfo(NetworkId networkId, LayerBindingId layerId) const; // Evaluates network using input in inputTensors, outputs filled into outputTensors. - virtual Status EnqueueWorkload(NetworkId networkId, + Status EnqueueWorkload(NetworkId networkId, const InputTensors& inputTensors, - const OutputTensors& outputTensors) override; + const OutputTensors& outputTensors); /// Unloads a network from the Runtime. /// At the moment this only removes the network from the m_Impl->m_Network. /// This might need more work in the future to be AndroidNN compliant. /// @param [in] networkId Unique identifier for the network to be unloaded. Generated in LoadNetwork(). /// @return armnn::Status - virtual Status UnloadNetwork(NetworkId networkId) override; + Status UnloadNetwork(NetworkId networkId); - virtual const IDeviceSpec& GetDeviceSpec() const override { return m_DeviceSpec; } + const IDeviceSpec& GetDeviceSpec() const { return m_DeviceSpec; } /// Gets the profiler corresponding to the given network id. /// @param networkId The id of the network for which to get the profile. /// @return A pointer to the requested profiler, or nullptr if not found. - virtual const std::shared_ptr GetProfiler(NetworkId networkId) const override; + const std::shared_ptr GetProfiler(NetworkId networkId) const; /// Registers a callback function to debug layers performing custom computations on intermediate tensors. /// @param networkId The id of the network to register the callback. /// @param func callback function to pass to the debug layer. - virtual void RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction& func) override; + void RegisterDebugCallback(NetworkId networkId, const DebugCallbackFunction& func); /// Creates a runtime for workload execution. - Runtime(const CreationOptions& options); + RuntimeImpl(const IRuntime::CreationOptions& options); - ~Runtime(); + ~RuntimeImpl(); //NOTE: we won't need the profiling service reference but it is good to pass the service // in this way to facilitate other implementations down the road - virtual void ReportStructure() override; + void ReportStructure(); private: - friend void RuntimeLoadedNetworksReserve(armnn::Runtime* runtime); // See RuntimeTests.cpp + friend void RuntimeLoadedNetworksReserve(RuntimeImpl* runtime); // See RuntimeTests.cpp - friend profiling::ProfilingService& GetProfilingService(armnn::Runtime* runtime); // See RuntimeTests.cpp + friend profiling::ProfilingService& GetProfilingService(RuntimeImpl* runtime); // See RuntimeTests.cpp int GenerateNetworkId(); diff --git a/src/armnn/test/RuntimeTests.cpp b/src/armnn/test/RuntimeTests.cpp index b3a8bbd6a6..1d5960b2a4 100644 --- a/src/armnn/test/RuntimeTests.cpp +++ b/src/armnn/test/RuntimeTests.cpp @@ -27,7 +27,7 @@ namespace armnn { -void RuntimeLoadedNetworksReserve(armnn::Runtime* runtime) +void RuntimeLoadedNetworksReserve(armnn::RuntimeImpl* runtime) { runtime->m_LoadedNetworks.reserve(1); } @@ -129,7 +129,7 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeak) // ensure that runtime is large enough before checking for memory leaks // otherwise when loading the network it will automatically reserve memory that won't be released until destruction armnn::IRuntime::CreationOptions options; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); armnn::RuntimeLoadedNetworksReserve(&runtime); { @@ -333,7 +333,7 @@ BOOST_AUTO_TEST_CASE(ProfilingDisable) // Create runtime in which the test will run armnn::IRuntime::CreationOptions options; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); // build up the structure of the network INetworkPtr net(INetwork::Create()); @@ -378,7 +378,7 @@ BOOST_AUTO_TEST_CASE(ProfilingEnableCpuRef) options.m_ProfilingOptions.m_EnableProfiling = true; options.m_ProfilingOptions.m_TimelineEnabled = true; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); GetProfilingService(&runtime).ResetExternalProfilingOptions(options.m_ProfilingOptions, false); profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); diff --git a/src/armnn/test/RuntimeTests.hpp b/src/armnn/test/RuntimeTests.hpp index 90aed5de1e..bca8324733 100644 --- a/src/armnn/test/RuntimeTests.hpp +++ b/src/armnn/test/RuntimeTests.hpp @@ -9,6 +9,6 @@ namespace armnn { -void RuntimeLoadedNetworksReserve(armnn::Runtime* runtime); +void RuntimeLoadedNetworksReserve(armnn::RuntimeImpl* runtime); } // namespace armnn diff --git a/src/armnn/test/TestUtils.cpp b/src/armnn/test/TestUtils.cpp index 6d7d02dcff..440d4e09f3 100644 --- a/src/armnn/test/TestUtils.cpp +++ b/src/armnn/test/TestUtils.cpp @@ -22,7 +22,7 @@ void Connect(armnn::IConnectableLayer* from, armnn::IConnectableLayer* to, const namespace armnn { -profiling::ProfilingService& GetProfilingService(armnn::Runtime* runtime) +profiling::ProfilingService& GetProfilingService(armnn::RuntimeImpl* runtime) { return runtime->m_ProfilingService; } diff --git a/src/armnn/test/TestUtils.hpp b/src/armnn/test/TestUtils.hpp index 9c5f672a5a..bf222b3c56 100644 --- a/src/armnn/test/TestUtils.hpp +++ b/src/armnn/test/TestUtils.hpp @@ -52,6 +52,6 @@ bool CheckRelatedLayers(armnn::Graph& graph, const std::list& testR namespace armnn { -profiling::ProfilingService& GetProfilingService(armnn::Runtime* runtime); +profiling::ProfilingService& GetProfilingService(RuntimeImpl* runtime); } // namespace armnn \ No newline at end of file diff --git a/src/backends/backendsCommon/test/BackendProfilingTests.cpp b/src/backends/backendsCommon/test/BackendProfilingTests.cpp index 4b0d26e0c3..d0f8fbe9c3 100644 --- a/src/backends/backendsCommon/test/BackendProfilingTests.cpp +++ b/src/backends/backendsCommon/test/BackendProfilingTests.cpp @@ -121,7 +121,7 @@ BOOST_AUTO_TEST_CASE(BackendProfilingCounterRegisterMockBackendTest) armnn::MockBackendInitialiser initialiser; // Create a runtime - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); unsigned int shiftedId = 0; diff --git a/src/backends/backendsCommon/test/RuntimeTestImpl.hpp b/src/backends/backendsCommon/test/RuntimeTestImpl.hpp index 33a629faac..4afa9bfb24 100644 --- a/src/backends/backendsCommon/test/RuntimeTestImpl.hpp +++ b/src/backends/backendsCommon/test/RuntimeTestImpl.hpp @@ -10,7 +10,7 @@ namespace { -inline void CreateAndDropDummyNetwork(const std::vector& backends, armnn::Runtime& runtime) +inline void CreateAndDropDummyNetwork(const std::vector& backends, armnn::RuntimeImpl& runtime) { armnn::NetworkId networkIdentifier; { diff --git a/src/backends/cl/test/ClRuntimeTests.cpp b/src/backends/cl/test/ClRuntimeTests.cpp index a0d7963aa8..33e86b6fc4 100644 --- a/src/backends/cl/test/ClRuntimeTests.cpp +++ b/src/backends/cl/test/ClRuntimeTests.cpp @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeaksGpuAcc) { BOOST_TEST(ARMNN_LEAK_CHECKER_IS_ACTIVE()); armnn::IRuntime::CreationOptions options; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); armnn::RuntimeLoadedNetworksReserve(&runtime); std::vector backends = {armnn::Compute::GpuAcc}; diff --git a/src/backends/neon/test/NeonRuntimeTests.cpp b/src/backends/neon/test/NeonRuntimeTests.cpp index 2aaf422a68..27361dd43d 100644 --- a/src/backends/neon/test/NeonRuntimeTests.cpp +++ b/src/backends/neon/test/NeonRuntimeTests.cpp @@ -42,7 +42,7 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeaksCpuAcc) { BOOST_TEST(ARMNN_LEAK_CHECKER_IS_ACTIVE()); armnn::IRuntime::CreationOptions options; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); armnn::RuntimeLoadedNetworksReserve(&runtime); std::vector backends = {armnn::Compute::CpuAcc}; diff --git a/src/backends/reference/test/RefOptimizedNetworkTests.cpp b/src/backends/reference/test/RefOptimizedNetworkTests.cpp index d430f251a4..16ff202f70 100644 --- a/src/backends/reference/test/RefOptimizedNetworkTests.cpp +++ b/src/backends/reference/test/RefOptimizedNetworkTests.cpp @@ -17,7 +17,8 @@ BOOST_AUTO_TEST_CASE(OptimizeValidateCpuRefWorkloads) { const armnn::TensorInfo desc({3, 5}, armnn::DataType::Float32); - armnn::Network net; + // build up the structure of the network + armnn::INetworkPtr net(armnn::INetwork::Create()); armnn::NormalizationDescriptor nmDesc; armnn::ActivationDescriptor acDesc; @@ -33,21 +34,21 @@ BOOST_AUTO_TEST_CASE(OptimizeValidateCpuRefWorkloads) // sm // | // ot - armnn::IConnectableLayer* layer = net.AddInputLayer(0, "in"); + armnn::IConnectableLayer* layer = net->AddInputLayer(0, "in"); layer->GetOutputSlot(0).SetTensorInfo(desc); - armnn::IConnectableLayer* const normLayer = net.AddNormalizationLayer(nmDesc, "nm"); + armnn::IConnectableLayer* const normLayer = net->AddNormalizationLayer(nmDesc, "nm"); layer->GetOutputSlot(0).Connect(normLayer->GetInputSlot(0)); normLayer->GetOutputSlot(0).SetTensorInfo(desc); - layer = net.AddActivationLayer(acDesc, "ac"); + layer = net->AddActivationLayer(acDesc, "ac"); normLayer->GetOutputSlot(0).Connect(layer->GetInputSlot(0)); layer->GetOutputSlot(0).SetTensorInfo(desc); armnn::IConnectableLayer* prevLayer = layer; - layer = net.AddMultiplicationLayer("ml"); + layer = net->AddMultiplicationLayer("ml"); prevLayer->GetOutputSlot(0).Connect(layer->GetInputSlot(0)); normLayer->GetOutputSlot(0).Connect(layer->GetInputSlot(1)); @@ -55,13 +56,13 @@ BOOST_AUTO_TEST_CASE(OptimizeValidateCpuRefWorkloads) prevLayer = layer; armnn::SoftmaxDescriptor softmaxDescriptor; - layer = net.AddSoftmaxLayer(softmaxDescriptor, "sm"); + layer = net->AddSoftmaxLayer(softmaxDescriptor, "sm"); prevLayer->GetOutputSlot(0).Connect(layer->GetInputSlot(0)); layer->GetOutputSlot(0).SetTensorInfo(desc); prevLayer = layer; - layer = net.AddOutputLayer(0, "ot"); + layer = net->AddOutputLayer(0, "ot"); prevLayer->GetOutputSlot(0).Connect(layer->GetInputSlot(0)); @@ -69,7 +70,7 @@ BOOST_AUTO_TEST_CASE(OptimizeValidateCpuRefWorkloads) armnn::IRuntimePtr runtime(armnn::IRuntime::Create(options)); std::vector backends = { armnn::Compute::CpuRef }; - armnn::IOptimizedNetworkPtr optNet = armnn::Optimize(net, backends, runtime->GetDeviceSpec()); + armnn::IOptimizedNetworkPtr optNet = armnn::Optimize(*net, backends, runtime->GetDeviceSpec()); static_cast(optNet.get())->GetGraph().AllocateDynamicBuffers(); BOOST_CHECK(optNet); @@ -149,7 +150,8 @@ BOOST_AUTO_TEST_CASE(OptimizeValidateWorkloadsCpuRefMeanLayer) BOOST_AUTO_TEST_CASE(DebugTestOnCpuRef) { - armnn::Network net; + // build up the structure of the network + armnn::INetworkPtr net(armnn::INetwork::Create()); armnn::ActivationDescriptor activation1Descriptor; activation1Descriptor.m_Function = armnn::ActivationFunction::BoundedReLu; @@ -157,9 +159,9 @@ BOOST_AUTO_TEST_CASE(DebugTestOnCpuRef) activation1Descriptor.m_B = -1.f; // Defines layers. - auto input = net.AddInputLayer(0, "InputLayer"); - auto activation = net.AddActivationLayer(activation1Descriptor, "ActivationLayer"); - auto output = net.AddOutputLayer(0, "OutputLayer"); + auto input = net->AddInputLayer(0, "InputLayer"); + auto activation = net->AddActivationLayer(activation1Descriptor, "ActivationLayer"); + auto output = net->AddOutputLayer(0, "OutputLayer"); // Connects layers. input->GetOutputSlot(0).Connect(activation->GetInputSlot(0)); @@ -178,7 +180,7 @@ BOOST_AUTO_TEST_CASE(DebugTestOnCpuRef) armnn::OptimizerOptions optimizerOptions; optimizerOptions.m_Debug = true; - armnn::IOptimizedNetworkPtr optimizedNet = armnn::Optimize(net, backends, runtime->GetDeviceSpec(), + armnn::IOptimizedNetworkPtr optimizedNet = armnn::Optimize(*net, backends, runtime->GetDeviceSpec(), optimizerOptions); const armnn::Graph& graph = static_cast(optimizedNet.get())->GetGraph(); diff --git a/src/backends/reference/test/RefRuntimeTests.cpp b/src/backends/reference/test/RefRuntimeTests.cpp index ae49366c62..17d5816b9b 100644 --- a/src/backends/reference/test/RefRuntimeTests.cpp +++ b/src/backends/reference/test/RefRuntimeTests.cpp @@ -19,7 +19,7 @@ BOOST_AUTO_TEST_CASE(RuntimeMemoryLeaksCpuRef) BOOST_TEST(ARMNN_LEAK_CHECKER_IS_ACTIVE()); armnn::IRuntime::CreationOptions options; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); armnn::RuntimeLoadedNetworksReserve(&runtime); std::vector backends = {armnn::Compute::CpuRef}; diff --git a/src/profiling/FileOnlyProfilingConnection.hpp b/src/profiling/FileOnlyProfilingConnection.hpp index 8bde0abdea..9ad2c94e07 100644 --- a/src/profiling/FileOnlyProfilingConnection.hpp +++ b/src/profiling/FileOnlyProfilingConnection.hpp @@ -50,7 +50,7 @@ private: class FileOnlyProfilingConnection : public IProfilingConnection, public IInternalProfilingConnection { public: - explicit FileOnlyProfilingConnection(const Runtime::CreationOptions::ExternalProfilingOptions& options) + explicit FileOnlyProfilingConnection(const IRuntime::CreationOptions::ExternalProfilingOptions& options) : m_Options(options) , m_Endianness(TargetEndianness::LeWire) // Set a sensible default. // StreamMetaDataProcessor will set a real value. @@ -103,7 +103,7 @@ private: void ForwardPacketToHandlers(arm::pipe::Packet& packet); void ServiceLocalHandlers(); - Runtime::CreationOptions::ExternalProfilingOptions m_Options; + IRuntime::CreationOptions::ExternalProfilingOptions m_Options; std::queue m_PacketQueue; TargetEndianness m_Endianness; diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp index 84aae9d39f..9ac7cc03e4 100644 --- a/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp +++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.cpp @@ -18,7 +18,7 @@ namespace profiling ProfilingConnectionDumpToFileDecorator::ProfilingConnectionDumpToFileDecorator( std::unique_ptr connection, - const Runtime::CreationOptions::ExternalProfilingOptions& options, + const IRuntime::CreationOptions::ExternalProfilingOptions& options, bool ignoreFailures) : m_Connection(std::move(connection)) , m_Options(options) diff --git a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp index aedb28571e..f1b9324d2b 100644 --- a/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp +++ b/src/profiling/ProfilingConnectionDumpToFileDecorator.hpp @@ -27,7 +27,7 @@ class ProfilingConnectionDumpToFileDecorator : public IProfilingConnection public: ProfilingConnectionDumpToFileDecorator(std::unique_ptr connection, - const Runtime::CreationOptions::ExternalProfilingOptions& options, + const IRuntime::CreationOptions::ExternalProfilingOptions& options, bool ignoreFailures = false); ~ProfilingConnectionDumpToFileDecorator(); @@ -51,11 +51,11 @@ private: void Fail(const std::string& errorMessage); - std::unique_ptr m_Connection; - Runtime::CreationOptions::ExternalProfilingOptions m_Options; - std::ofstream m_IncomingDumpFileStream; - std::ofstream m_OutgoingDumpFileStream; - bool m_IgnoreFileErrors; + std::unique_ptr m_Connection; + IRuntime::CreationOptions::ExternalProfilingOptions m_Options; + std::ofstream m_IncomingDumpFileStream; + std::ofstream m_OutgoingDumpFileStream; + bool m_IgnoreFileErrors; }; } // namespace profiling diff --git a/src/profiling/ProfilingConnectionFactory.cpp b/src/profiling/ProfilingConnectionFactory.cpp index 96f7ed4b06..b5af5a7efa 100644 --- a/src/profiling/ProfilingConnectionFactory.cpp +++ b/src/profiling/ProfilingConnectionFactory.cpp @@ -16,7 +16,7 @@ namespace profiling { std::unique_ptr ProfilingConnectionFactory::GetProfilingConnection( - const Runtime::CreationOptions::ExternalProfilingOptions& options) const + const IRuntime::CreationOptions::ExternalProfilingOptions& options) const { // Before proceed to create the IProfilingConnection, check if the file format is supported if (!(options.m_FileFormat == "binary")) diff --git a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp index 943650a8f1..813bb49b72 100644 --- a/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp +++ b/src/profiling/test/FileOnlyProfilingDecoratorTests.cpp @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(TestFileOnlyProfiling) { // Enable m_FileOnly but also provide ILocalPacketHandler which should consume the packets. // This won't dump anything to file. - armnn::Runtime::CreationOptions creationOptions; + armnn::IRuntime::CreationOptions creationOptions; creationOptions.m_ProfilingOptions.m_EnableProfiling = true; creationOptions.m_ProfilingOptions.m_FileOnly = true; creationOptions.m_ProfilingOptions.m_CapturePeriod = 100; @@ -53,7 +53,7 @@ BOOST_AUTO_TEST_CASE(TestFileOnlyProfiling) ILocalPacketHandlerSharedPtr localPacketHandlerPtr = std::make_shared(); creationOptions.m_ProfilingOptions.m_LocalPacketHandlers.push_back(localPacketHandlerPtr); - armnn::Runtime runtime(creationOptions); + armnn::RuntimeImpl runtime(creationOptions); // ensure the GUID generator is reset to zero GetProfilingService(&runtime).ResetGuidGenerator(); @@ -164,7 +164,7 @@ BOOST_AUTO_TEST_CASE(DumpOutgoingValidFileEndToEnd) // Make sure the file does not exist at this point BOOST_CHECK(!fs::exists(tempPath)); - armnn::Runtime::CreationOptions options; + armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; options.m_ProfilingOptions.m_FileOnly = true; options.m_ProfilingOptions.m_IncomingCaptureFile = ""; @@ -175,7 +175,7 @@ BOOST_AUTO_TEST_CASE(DumpOutgoingValidFileEndToEnd) ILocalPacketHandlerSharedPtr localPacketHandlerPtr = std::make_shared(); options.m_ProfilingOptions.m_LocalPacketHandlers.push_back(localPacketHandlerPtr); - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); // ensure the GUID generator is reset to zero GetProfilingService(&runtime).ResetGuidGenerator(); diff --git a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp index 0feed4138f..2ebba5d8d1 100644 --- a/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp +++ b/src/profiling/test/ProfilingConnectionDumpToFileDecoratorTests.cpp @@ -78,7 +78,7 @@ BOOST_AUTO_TEST_SUITE(ProfilingConnectionDumpToFileDecoratorTests) BOOST_AUTO_TEST_CASE(DumpIncomingInvalidFile) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_IncomingCaptureFile = "/"; options.m_OutgoingCaptureFile = ""; ProfilingConnectionDumpToFileDecorator decorator(std::make_unique(), options, false); @@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(DumpIncomingInvalidFile) BOOST_AUTO_TEST_CASE(DumpIncomingInvalidFileIgnoreErrors) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_IncomingCaptureFile = "/"; options.m_OutgoingCaptureFile = ""; ProfilingConnectionDumpToFileDecorator decorator(std::make_unique(), options, true); @@ -98,7 +98,7 @@ BOOST_AUTO_TEST_CASE(DumpIncomingValidFile) { fs::path fileName = armnnUtils::Filesystem::NamedTempFile("Armnn-DumpIncomingValidFileTest-TempFile"); - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_IncomingCaptureFile = fileName.string(); options.m_OutgoingCaptureFile = ""; @@ -122,7 +122,7 @@ BOOST_AUTO_TEST_CASE(DumpIncomingValidFile) BOOST_AUTO_TEST_CASE(DumpOutgoingInvalidFile) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_IncomingCaptureFile = ""; options.m_OutgoingCaptureFile = "/"; ProfilingConnectionDumpToFileDecorator decorator(std::make_unique(), options, false); @@ -131,7 +131,7 @@ BOOST_AUTO_TEST_CASE(DumpOutgoingInvalidFile) BOOST_AUTO_TEST_CASE(DumpOutgoingInvalidFileIgnoreErrors) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_IncomingCaptureFile = ""; options.m_OutgoingCaptureFile = "/"; @@ -146,7 +146,7 @@ BOOST_AUTO_TEST_CASE(DumpOutgoingValidFile) { fs::path fileName = armnnUtils::Filesystem::NamedTempFile("Armnn-DumpOutgoingValidFileTest-TempFile"); - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_IncomingCaptureFile = ""; options.m_OutgoingCaptureFile = fileName.string(); diff --git a/src/profiling/test/ProfilingTestUtils.cpp b/src/profiling/test/ProfilingTestUtils.cpp index 93d0b10d4b..faa86e55bf 100644 --- a/src/profiling/test/ProfilingTestUtils.cpp +++ b/src/profiling/test/ProfilingTestUtils.cpp @@ -366,7 +366,7 @@ void VerifyPostOptimisationStructureTestImpl(armnn::BackendId backendId) armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; options.m_ProfilingOptions.m_TimelineEnabled = true; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); GetProfilingService(&runtime).ResetExternalProfilingOptions(options.m_ProfilingOptions, false); profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); diff --git a/src/profiling/test/ProfilingTests.cpp b/src/profiling/test/ProfilingTests.cpp index ff45a454c3..6999650fba 100644 --- a/src/profiling/test/ProfilingTests.cpp +++ b/src/profiling/test/ProfilingTests.cpp @@ -655,7 +655,7 @@ BOOST_AUTO_TEST_CASE(CaptureDataMethods) BOOST_AUTO_TEST_CASE(CheckProfilingServiceDisabled) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -665,7 +665,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceDisabled) BOOST_AUTO_TEST_CASE(CheckProfilingServiceCounterDirectory) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -688,7 +688,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceCounterDirectory) BOOST_AUTO_TEST_CASE(CheckProfilingServiceCounterValues) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -2006,7 +2006,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceNotActive) armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); profiling::ProfilingServiceRuntimeHelper profilingServiceHelper(GetProfilingService(&runtime)); profilingServiceHelper.ForceTransitionToState(ProfilingState::NotConnected); profilingServiceHelper.ForceTransitionToState(ProfilingState::WaitingForAck); @@ -2548,7 +2548,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodConnectionAcknowledgedPacket) unsigned int streamMetadataPacketsize = GetStreamMetaDataPacketSize(); // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -2608,7 +2608,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodConnectionAcknowledgedPacket) BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodRequestCounterDirectoryPacket) { // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -2666,7 +2666,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodRequestCounterDirectoryPacket) BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadPeriodicCounterSelectionPacketInvalidCounterUid) { // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -2745,7 +2745,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadPeriodicCounterSelectionPacketInval BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketNoCounters) { // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -2810,7 +2810,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketNoCo BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketSingleCounter) { // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -2887,7 +2887,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketSing BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketMultipleCounters) { // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -2966,7 +2966,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPeriodicCounterSelectionPacketMult BOOST_AUTO_TEST_CASE(CheckProfilingServiceDisconnect) { // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -3024,7 +3024,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceDisconnect) BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPerJobCounterSelectionPacket) { // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -3091,7 +3091,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceGoodPerJobCounterSelectionPacket) BOOST_AUTO_TEST_CASE(CheckConfigureProfilingServiceOn) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -3105,7 +3105,7 @@ BOOST_AUTO_TEST_CASE(CheckConfigureProfilingServiceOn) BOOST_AUTO_TEST_CASE(CheckConfigureProfilingServiceOff) { - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; armnn::profiling::ProfilingService profilingService; BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); profilingService.ConfigureProfilingService(options); @@ -3120,7 +3120,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceEnabled) { // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -3151,7 +3151,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceEnabledRuntime) { // Locally reduce log level to "Warning", as this test needs to parse a warning message from the standard output LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); BOOST_CHECK(profilingService.GetCurrentState() == ProfilingState::Uninitialised); @@ -3193,7 +3193,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadConnectionAcknowledgedPacket) StreamRedirector streamRedirector(std::cout, ss.rdbuf()); // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -3255,7 +3255,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadRequestCounterDirectoryPacket) StreamRedirector streamRedirector(std::cout, ss.rdbuf()); // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -3319,7 +3319,7 @@ BOOST_AUTO_TEST_CASE(CheckProfilingServiceBadPeriodicCounterSelectionPacket) StreamRedirector streamRedirector(std::cout, ss.rdbuf()); // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; armnn::profiling::ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -3420,7 +3420,7 @@ BOOST_AUTO_TEST_CASE(CheckRegisterBackendCounters) armnn::BackendId cpuRefId(armnn::Compute::CpuRef); // Reset the profiling service to the uninitialized state - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; ProfilingService profilingService; profilingService.ResetExternalProfilingOptions(options, true); @@ -3604,7 +3604,7 @@ BOOST_AUTO_TEST_CASE(CheckCounterStatusQuery) BOOST_AUTO_TEST_CASE(CheckRegisterCounters) { - armnn::Runtime::CreationOptions options; + armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; MockBufferManager mockBuffer(1024); @@ -3666,7 +3666,7 @@ BOOST_AUTO_TEST_CASE(CheckFileFormat) { LogLevelSwapper logLevelSwapper(armnn::LogSeverity::Warning); // Create profiling options. - armnn::Runtime::CreationOptions::ExternalProfilingOptions options; + armnn::IRuntime::CreationOptions::ExternalProfilingOptions options; options.m_EnableProfiling = true; // Check the default value set to binary BOOST_CHECK(options.m_FileFormat == "binary"); diff --git a/src/profiling/test/SendTimelinePacketTests.cpp b/src/profiling/test/SendTimelinePacketTests.cpp index 7b68bb9753..244f23dfb4 100644 --- a/src/profiling/test/SendTimelinePacketTests.cpp +++ b/src/profiling/test/SendTimelinePacketTests.cpp @@ -427,7 +427,7 @@ BOOST_AUTO_TEST_CASE(GetGuidsFromProfilingService) { armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); armnn::profiling::ProfilingService profilingService(runtime); profilingService.ResetExternalProfilingOptions(options.m_ProfilingOptions, true); diff --git a/tests/profiling/gatordmock/tests/GatordMockTests.cpp b/tests/profiling/gatordmock/tests/GatordMockTests.cpp index 4fd884cec4..b88ad45d11 100644 --- a/tests/profiling/gatordmock/tests/GatordMockTests.cpp +++ b/tests/profiling/gatordmock/tests/GatordMockTests.cpp @@ -404,7 +404,7 @@ BOOST_AUTO_TEST_CASE(GatorDMockTimeLineActivation) armnn::IRuntime::CreationOptions options; options.m_ProfilingOptions.m_EnableProfiling = true; options.m_ProfilingOptions.m_TimelineEnabled = true; - armnn::Runtime runtime(options); + armnn::RuntimeImpl runtime(options); auto basePipeServer = connectionHandler.GetNewBasePipeServer(false); gatordmock::GatordMockService mockService(std::move(basePipeServer), false); -- cgit v1.2.1