COMPMID-1919: Opencl - Tuning with Instrumentation does not work

Change-Id: Iee6a07d5bf6a35af04071865682bcc4a615c14f9
Signed-off-by: Vidhya Sudhan Loganathan <vidhyasudhan.loganathan@arm.com>
Reviewed-on: https://review.mlplatform.org/638
Reviewed-by: Giuseppe Rossini <giuseppe.rossini@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Pablo Marquez <pablo.tello@arm.com>
diff --git a/tests/framework/instruments/OpenCLTimer.cpp b/tests/framework/instruments/OpenCLTimer.cpp
index 2fd5714..ca859b6 100644
--- a/tests/framework/instruments/OpenCLTimer.cpp
+++ b/tests/framework/instruments/OpenCLTimer.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2018 ARM Limited.
+ * Copyright (c) 2017-2019 ARM Limited.
  *
  * SPDX-License-Identifier: MIT
  *
@@ -107,9 +107,6 @@
     {
         if(this->_timer_enabled)
         {
-            ARM_COMPUTE_ERROR_ON_MSG(event != nullptr, "Not supported");
-            ARM_COMPUTE_UNUSED(event);
-
             kernel_info       info;
             cl::Kernel        cpp_kernel(kernel, true);
             std::stringstream ss;
@@ -127,6 +124,13 @@
             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));
+
+            if(event != nullptr)
+            {
+                //return cl_event from the intercepted call
+                clRetainEvent(tmp);
+                *event = tmp;
+            }
             return retval;
         }
         else