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 --- src/armnn/Runtime.hpp | 45 ++++++++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 23 deletions(-) (limited to 'src/armnn/Runtime.hpp') 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(); -- cgit v1.2.1