diff options
author | Anthony Barbier <anthony.barbier@arm.com> | 2018-05-16 14:20:04 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:52:35 +0000 |
commit | c483521dd36134acd659341f7629e0c02b1f23d9 (patch) | |
tree | f71c3fd75826309a89cd95016f52c0d5a9b4b5c1 | |
parent | 4d0a8d6a8f7cc2b5964cc69990e9f3a3ea7e036d (diff) | |
download | ComputeLibrary-c483521dd36134acd659341f7629e0c02b1f23d9.tar.gz |
COMPMID-959: Only intercept clEnqueueNDRangeKernel when the timer is enabled
Otherwise we'll start intercepting the cl_tuner run, which we don't want
Change-Id: Ib3d835a02a6cec9617a715bfbeaed506792a00fc
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/131478
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
-rw-r--r-- | tests/framework/instruments/OpenCLTimer.cpp | 48 | ||||
-rw-r--r-- | tests/framework/instruments/OpenCLTimer.h | 2 |
2 files changed, 32 insertions, 18 deletions
diff --git a/tests/framework/instruments/OpenCLTimer.cpp b/tests/framework/instruments/OpenCLTimer.cpp index 4af6dae8e7..4391c433e5 100644 --- a/tests/framework/instruments/OpenCLTimer.cpp +++ b/tests/framework/instruments/OpenCLTimer.cpp @@ -45,7 +45,7 @@ std::string OpenCLTimer::id() const } OpenCLTimer::OpenCLTimer(ScaleFactor scale_factor) - : _kernels(), _real_function(nullptr), _real_graph_function(nullptr), _prefix() + : _kernels(), _real_function(nullptr), _real_graph_function(nullptr), _prefix(), _timer_enabled(false) { auto q = CLScheduler::get().queue(); cl_command_queue_properties props = q.getInfo<CL_QUEUE_PROPERTIES>(); @@ -95,27 +95,34 @@ void OpenCLTimer::test_start() const cl_event * event_wait_list, cl_event * event) { - ARM_COMPUTE_ERROR_ON_MSG(event != nullptr, "Not supported"); - ARM_COMPUTE_UNUSED(event); - - OpenCLTimer::kernel_info info; - cl::Kernel cpp_kernel(kernel, true); - std::stringstream ss; - ss << this->_prefix << cpp_kernel.getInfo<CL_KERNEL_FUNCTION_NAME>(); - if(gws != nullptr) + if(this->_timer_enabled) { - ss << " GWS[" << gws[0] << "," << gws[1] << "," << gws[2] << "]"; + ARM_COMPUTE_ERROR_ON_MSG(event != nullptr, "Not supported"); + ARM_COMPUTE_UNUSED(event); + + OpenCLTimer::kernel_info info; + cl::Kernel cpp_kernel(kernel, true); + std::stringstream ss; + ss << this->_prefix << cpp_kernel.getInfo<CL_KERNEL_FUNCTION_NAME>(); + if(gws != nullptr) + { + ss << " GWS[" << gws[0] << "," << gws[1] << "," << gws[2] << "]"; + } + if(lws != nullptr) + { + ss << " LWS[" << lws[0] << "," << lws[1] << "," << lws[2] << "]"; + } + info.name = ss.str(); + cl_event tmp; + cl_int retval = this->_real_function(command_queue, kernel, work_dim, gwo, gws, lws, num_events_in_wait_list, event_wait_list, &tmp); + info.event = tmp; + this->_kernels.push_back(std::move(info)); + return retval; } - if(lws != nullptr) + else { - ss << " LWS[" << lws[0] << "," << lws[1] << "," << lws[2] << "]"; + return this->_real_function(command_queue, kernel, work_dim, gwo, gws, lws, num_events_in_wait_list, event_wait_list, event); } - info.name = ss.str(); - cl_event tmp; - cl_int retval = this->_real_function(command_queue, kernel, work_dim, gwo, gws, lws, num_events_in_wait_list, event_wait_list, &tmp); - info.event = tmp; - this->_kernels.push_back(std::move(info)); - return retval; }; // Start intercepting tasks: @@ -140,6 +147,11 @@ void OpenCLTimer::test_start() void OpenCLTimer::start() { _kernels.clear(); + _timer_enabled = true; +} +void OpenCLTimer::stop() +{ + _timer_enabled = false; } void OpenCLTimer::test_stop() diff --git a/tests/framework/instruments/OpenCLTimer.h b/tests/framework/instruments/OpenCLTimer.h index 059f4493f9..c5f3bce92a 100644 --- a/tests/framework/instruments/OpenCLTimer.h +++ b/tests/framework/instruments/OpenCLTimer.h @@ -52,6 +52,7 @@ public: std::string id() const override; void test_start() override; void start() override; + void stop() override; void test_stop() override; MeasurementsMap measurements() const override; @@ -66,6 +67,7 @@ private: std::function<decltype(clEnqueueNDRangeKernel)> _real_function; std::function<decltype(graph::execute_task)> _real_graph_function; std::string _prefix; + bool _timer_enabled; #endif /* ARM_COMPUTE_CL */ private: |