diff options
author | Derek Lamberti <derek.lamberti@arm.com> | 2018-10-01 09:28:57 +0100 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2018-10-10 16:16:57 +0100 |
commit | e4ba53a85c559d4fe574305276ac815cf7995762 (patch) | |
tree | e3f8a3e1b54b2a9cf1e21909f5e4ad9e285be49d /src/armnn/NeonTimer.cpp | |
parent | fcb382af87e79ae4bdc6a604241efbf2533e1737 (diff) | |
download | armnn-e4ba53a85c559d4fe574305276ac815cf7995762.tar.gz |
IVGCVSW-1824 Fix slow profiling of neon. (~50% reduced end-to-end time)
Change-Id: I58295c298934317a2b365887bd9f9f6705cd0a21
Diffstat (limited to 'src/armnn/NeonTimer.cpp')
-rw-r--r-- | src/armnn/NeonTimer.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/armnn/NeonTimer.cpp b/src/armnn/NeonTimer.cpp index 1ee0c64103..219edc9680 100644 --- a/src/armnn/NeonTimer.cpp +++ b/src/armnn/NeonTimer.cpp @@ -13,24 +13,31 @@ namespace armnn { +namespace +{ +static thread_local auto g_Interceptor = std::make_shared<NeonInterceptorScheduler>(arm_compute::Scheduler::get()); +} void NeonTimer::Start() { m_Kernels.clear(); + BOOST_ASSERT(g_Interceptor->GetKernels() == nullptr); + g_Interceptor->SetKernels(&m_Kernels); + m_RealSchedulerType = arm_compute::Scheduler::get_type(); //Note: We can't currently replace a custom scheduler if(m_RealSchedulerType != arm_compute::Scheduler::Type::CUSTOM) { // Keep the real schedule and add NeonInterceptorScheduler as an interceptor m_RealScheduler = &arm_compute::Scheduler::get(); - auto interceptor = std::make_shared<NeonInterceptorScheduler>(m_Kernels, *m_RealScheduler); - arm_compute::Scheduler::set(std::static_pointer_cast<arm_compute::IScheduler>(interceptor)); + arm_compute::Scheduler::set(std::static_pointer_cast<arm_compute::IScheduler>(g_Interceptor)); } } void NeonTimer::Stop() { // Restore real scheduler + g_Interceptor->SetKernels(nullptr); arm_compute::Scheduler::set(m_RealSchedulerType); m_RealScheduler = nullptr; } |