diff options
author | alered01 <Alex.Redshaw@arm.com> | 2020-05-07 14:58:29 +0100 |
---|---|---|
committer | Jan Eilers <jan.eilers@arm.com> | 2020-05-22 14:42:37 +0100 |
commit | 72b415674e7df9152a1e5d206b70e4d7a663f3fc (patch) | |
tree | bc5cf924de58f5c0a134bbe9304664d13b7f86a5 /src | |
parent | f668f94de9a07d0bf488c10142a99c910f3b6640 (diff) | |
download | armnn-72b415674e7df9152a1e5d206b70e4d7a663f3fc.tar.gz |
Adding more performance metrics
* Implemented CLTuning flow for ExecuteNetwork tests
* Added --tuning-path to specify tuning file to use/create
* Added --tuning-level to specify tuning level to use as well as enable extra tuning run to generate the tuning file
* Fixed issue where TuningLevel was being parsed incorrectly
* Added measurements for initialization, network parsing, network optimization, tuning, and shutdown
* Added flag to control number of iterations inference is run for
Signed-off-by: alered01 <Alex.Redshaw@arm.com>
Change-Id: Ic739ff26e136e32aff9f0995217c1c3207008ca4
Diffstat (limited to 'src')
-rw-r--r-- | src/armnn/Runtime.cpp | 8 | ||||
-rw-r--r-- | src/backends/cl/ClBackendContext.cpp | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/armnn/Runtime.cpp b/src/armnn/Runtime.cpp index dbdd409784..b1b7d51d7c 100644 --- a/src/armnn/Runtime.cpp +++ b/src/armnn/Runtime.cpp @@ -7,6 +7,7 @@ #include <armnn/Version.hpp> #include <armnn/BackendRegistry.hpp> #include <armnn/Logging.hpp> +#include <armnn/utility/Timer.hpp> #include <armnn/backends/IBackendContext.hpp> #include <backendsCommon/DynamicBackendUtils.hpp> @@ -171,6 +172,7 @@ Runtime::Runtime(const CreationOptions& options) : m_NetworkIdCounter(0), m_ProfilingService(*this) { + const auto start_time = armnn::GetTimeNow(); ARMNN_LOG(info) << "ArmNN v" << ARMNN_VERSION << "\n"; if ( options.m_ProfilingOptions.m_TimelineEnabled && !options.m_ProfilingOptions.m_EnableProfiling ) @@ -225,10 +227,14 @@ Runtime::Runtime(const CreationOptions& options) m_ProfilingService.ConfigureProfilingService(options.m_ProfilingOptions); m_DeviceSpec.AddSupportedBackends(supportedBackends); + + ARMNN_LOG(info) << "Initialization time: " << std::setprecision(2) + << std::fixed << armnn::GetTimeDuration(start_time).count() << " ms\n"; } Runtime::~Runtime() { + const auto start_time = armnn::GetTimeNow(); std::vector<int> networkIDs; try { @@ -272,6 +278,8 @@ Runtime::~Runtime() m_BackendContexts.clear(); BackendRegistryInstance().SetProfilingService(armnn::EmptyOptional()); + ARMNN_LOG(info) << "Shutdown time: " << std::setprecision(2) + << std::fixed << armnn::GetTimeDuration(start_time).count() << " ms\n"; } LoadedNetwork* Runtime::GetLoadedNetworkPtr(NetworkId networkId) const diff --git a/src/backends/cl/ClBackendContext.cpp b/src/backends/cl/ClBackendContext.cpp index bfe93bdc01..42f42b3023 100644 --- a/src/backends/cl/ClBackendContext.cpp +++ b/src/backends/cl/ClBackendContext.cpp @@ -79,7 +79,7 @@ TuningLevel ParseTuningLevel(const BackendOptions::Var& value, TuningLevel defau { if (value.IsInt()) { - int v = value.IsInt(); + int v = value.AsInt(); if (v > static_cast<int>(TuningLevel::Exhaustive) || v < static_cast<int>(TuningLevel::None)) { @@ -218,18 +218,18 @@ ClBackendContext::ClBackendContext(const IRuntime::CreationOptions& options) ConfigureTuner(*(m_Tuner.get()), tuningLevel); - if (!m_TuningFile.empty()) + if (!m_TuningFile.empty() && tuningLevel == TuningLevel::None) { try { m_Tuner->load_from_file(m_TuningFile.c_str()); - } catch (const std::exception& e) + } + catch (const std::exception& e) { ARMNN_LOG(warning) << "Could not load GpuAcc tuner data file."; } - - tuner = m_Tuner.get(); } + tuner = m_Tuner.get(); } m_ClContextControlWrapper = std::make_unique<ClContextControlWrapper>( |