diff options
author | Ryan OShea <ryan.oshea3@arm.com> | 2023-03-20 11:10:40 +0000 |
---|---|---|
committer | Francis Murtagh <francis.murtagh@arm.com> | 2023-05-08 16:59:40 +0000 |
commit | a3dc95ec2b0ac9e7f87dd32d03679a4b2a9b5d2a (patch) | |
tree | f65bf6ebae620be85cd1122e32889b9e8b69e1b8 /profiling/client/src | |
parent | f6ed6d410dca0bbf22f338ca6e2fafd36d5c963f (diff) | |
download | armnn-a3dc95ec2b0ac9e7f87dd32d03679a4b2a9b5d2a.tar.gz |
Improve reusability of code that is defined out by cmake build paths
* Added new ARMNN_STUB_PROFILING and ARMNN_DISABLE_DYNAMIC_BACKEND
defines to replace BUILD_BARE_METAL and BUILD_EXECUTE_NETWORK_STATIC
* Add new CMake variables to disable sample apps and dynamic backends
* Improve BUILD_SHARED_LIBS CMake variable
* Add new archive output location to various libraries so that the
static libraries appear in the same location as the shared libraries
* Fixes for bare metal build
* Add ARMNN_DISABLE_FILE_SYSTEM defines to missing locations
Signed-off-by: Ryan OShea <ryan.oshea3@arm.com>
Change-Id: I1db9a8f483e7134bd261294b35240cf21b150d45
Diffstat (limited to 'profiling/client/src')
-rw-r--r-- | profiling/client/src/ProfilingService.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/profiling/client/src/ProfilingService.cpp b/profiling/client/src/ProfilingService.cpp index 37f0de9f6f..8dbe12ce69 100644 --- a/profiling/client/src/ProfilingService.cpp +++ b/profiling/client/src/ProfilingService.cpp @@ -10,7 +10,7 @@ #include <common/include/ProfilingGuid.hpp> #include <common/include/SocketConnectionException.hpp> -#if defined(ARMNN_BUILD_BARE_METAL) || defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if defined(ARMNN_STUB_PROFILING) #include <common/include/IgnoreUnused.hpp> #endif @@ -26,7 +26,7 @@ namespace pipe void ProfilingService::ResetExternalProfilingOptions(const arm::pipe::ProfilingOptions& options, bool resetProfilingService) { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) // Update the profiling options m_Options = options; m_TimelineReporting = options.m_TimelineEnabled; @@ -41,23 +41,23 @@ void ProfilingService::ResetExternalProfilingOptions(const arm::pipe::ProfilingO #else IgnoreUnused(options); IgnoreUnused(resetProfilingService); -#endif // ARMNN_BUILD_BARE_METAL || ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } bool ProfilingService::IsProfilingEnabled() const { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) return m_Options.m_EnableProfiling; #else return false; -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } ProfilingState ProfilingService::ConfigureProfilingService( const ProfilingOptions& options, bool resetProfilingService) { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) ResetExternalProfilingOptions(options, resetProfilingService); ProfilingState currentState = m_StateMachine.GetCurrentState(); if (options.m_EnableProfiling) @@ -106,12 +106,12 @@ ProfilingState ProfilingService::ConfigureProfilingService( IgnoreUnused(options); IgnoreUnused(resetProfilingService); return ProfilingState::Uninitialised; -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::Update() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) if (!m_Options.m_EnableProfiling) { // Don't run if profiling is disabled @@ -189,12 +189,12 @@ void ProfilingService::Update() throw arm::pipe::ProfilingException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::Disconnect() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) ProfilingState currentState = m_StateMachine.GetCurrentState(); switch (currentState) { @@ -211,7 +211,7 @@ void ProfilingService::Disconnect() throw arm::pipe::ProfilingException(fmt::format("Unknown profiling service state: {}", static_cast<int>(currentState))); } -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } // Store a profiling context returned from a backend that support profiling, and register its counters @@ -219,7 +219,7 @@ void ProfilingService::AddBackendProfilingContext( const std::string& backendId, std::shared_ptr<IBackendProfilingContext> profilingContext) { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) ARM_PIPE_ASSERT(profilingContext != nullptr); // Register the backend counters m_MaxGlobalCounterId = profilingContext->RegisterCounters(m_MaxGlobalCounterId); @@ -227,7 +227,7 @@ void ProfilingService::AddBackendProfilingContext( #else IgnoreUnused(backendId); IgnoreUnused(profilingContext); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } const ICounterDirectory& ProfilingService::GetCounterDirectory() const { @@ -343,14 +343,14 @@ std::unique_ptr<ISendTimelinePacket> ProfilingService::GetSendTimelinePacket() c void ProfilingService::Initialize() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) m_Initialiser.InitialiseProfilingService(*this); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::InitializeCounterValue(uint16_t counterUid) { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) // Increase the size of the counter index if necessary if (counterUid >= m_CounterIndex.size()) { @@ -365,12 +365,12 @@ void ProfilingService::InitializeCounterValue(uint16_t counterUid) m_CounterIndex.at(counterUid) = counterValuePtr; #else IgnoreUnused(counterUid); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::Reset() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) // Stop the profiling service... Stop(); @@ -384,12 +384,12 @@ void ProfilingService::Reset() // ...finally reset the profiling state machine m_StateMachine.Reset(); m_BackendProfilingContexts.clear(); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::Stop() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) { // only lock when we are updating the inference completed variable std::unique_lock<std::mutex> lck(m_ServiceActiveMutex); m_ServiceActive = false; @@ -411,24 +411,24 @@ void ProfilingService::Stop() // ...then move to the "NotConnected" state m_StateMachine.TransitionToState(ProfilingState::NotConnected); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } inline void ProfilingService::CheckCounterUid(uint16_t counterUid) const { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) if (!IsCounterRegistered(counterUid)) { throw arm::pipe::InvalidArgumentException(fmt::format("Counter UID {} is not registered", counterUid)); } #else IgnoreUnused(counterUid); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::NotifyBackendsForTimelineReporting() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) BackendProfilingContext::iterator it = m_BackendProfilingContexts.begin(); while (it != m_BackendProfilingContexts.end()) { @@ -437,23 +437,23 @@ void ProfilingService::NotifyBackendsForTimelineReporting() // Increment the Iterator to point to next entry it++; } -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::NotifyProfilingServiceActive() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) { // only lock when we are updating the inference completed variable std::unique_lock<std::mutex> lck(m_ServiceActiveMutex); m_ServiceActive = true; } m_ServiceActiveConditionVariable.notify_one(); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } void ProfilingService::WaitForProfilingServiceActivation(unsigned int timeout) { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) std::unique_lock<std::mutex> lck(m_ServiceActiveMutex); auto start = std::chrono::high_resolution_clock::now(); @@ -475,14 +475,14 @@ void ProfilingService::WaitForProfilingServiceActivation(unsigned int timeout) } #else IgnoreUnused(timeout); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } ProfilingService::~ProfilingService() { -#if !defined(ARMNN_BUILD_BARE_METAL) && !defined(ARMNN_EXECUTE_NETWORK_STATIC) +#if !defined(ARMNN_STUB_PROFILING) Stop(); -#endif // ARMNN_BUILD_BARE_METAL && ARMNN_EXECUTE_NETWORK_STATIC +#endif // ARMNN_STUB_PROFILING } } // namespace pipe |