From 85e6f518ace17547d6f35ed0e1cfbc39ffb95736 Mon Sep 17 00:00:00 2001 From: Gian Marco Date: Thu, 1 Feb 2018 16:57:48 +0000 Subject: COMPMID-891 - Use OpenCL timer in CLTuner Change-Id: I84a914c13b162c4f74321c9cafc30a18ad4ebbdb Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/118797 Tested-by: Jenkins Reviewed-by: Georgios Pinitas --- src/core/CL/OpenCL.cpp | 62 +++++++++++++++++++++- .../CLDepthwiseConvolutionLayer3x3Kernel.cpp | 14 +++++ 2 files changed, 75 insertions(+), 1 deletion(-) (limited to 'src/core/CL') diff --git a/src/core/CL/OpenCL.cpp b/src/core/CL/OpenCL.cpp index 726279c6ea..06d10a450e 100644 --- a/src/core/CL/OpenCL.cpp +++ b/src/core/CL/OpenCL.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -108,6 +108,9 @@ bool CLSymbols::load(const std::string &library) LOAD_FUNCTION_PTR(clRetainEvent, handle); LOAD_FUNCTION_PTR(clGetPlatformIDs, handle); LOAD_FUNCTION_PTR(clGetKernelWorkGroupInfo, handle); + LOAD_FUNCTION_PTR(clGetCommandQueueInfo, handle); + LOAD_FUNCTION_PTR(clGetKernelInfo, handle); + LOAD_FUNCTION_PTR(clGetEventProfilingInfo, handle); #undef LOAD_FUNCTION_PTR @@ -729,3 +732,60 @@ clGetKernelWorkGroupInfo(cl_kernel kernel, return CL_OUT_OF_RESOURCES; } } + +cl_int +clGetCommandQueueInfo(cl_command_queue command_queue, + cl_command_queue_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + arm_compute::CLSymbols::get().load_default(); + auto func = arm_compute::CLSymbols::get().clGetCommandQueueInfo_ptr; + if(func != nullptr) + { + return func(command_queue, param_name, param_value_size, param_value, param_value_size_ret); + } + else + { + return CL_OUT_OF_RESOURCES; + } +} + +cl_int +clGetKernelInfo(cl_kernel kernel, + cl_kernel_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + arm_compute::CLSymbols::get().load_default(); + auto func = arm_compute::CLSymbols::get().clGetKernelInfo_ptr; + if(func != nullptr) + { + return func(kernel, param_name, param_value_size, param_value, param_value_size_ret); + } + else + { + return CL_OUT_OF_RESOURCES; + } +} + +cl_int +clGetEventProfilingInfo(cl_event event, + cl_profiling_info param_name, + size_t param_value_size, + void *param_value, + size_t *param_value_size_ret) +{ + arm_compute::CLSymbols::get().load_default(); + auto func = arm_compute::CLSymbols::get().clGetEventProfilingInfo_ptr; + if(func != nullptr) + { + return func(event, param_name, param_value_size, param_value, param_value_size_ret); + } + else + { + return CL_OUT_OF_RESOURCES; + } +} \ No newline at end of file diff --git a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp index 1c0fe9984f..a9167ee859 100644 --- a/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseConvolutionLayer3x3Kernel.cpp @@ -174,6 +174,20 @@ void CLDepthwiseConvolutionLayer3x3Kernel::configure(const ICLTensor *input, con output_access.set_valid_region(win, ValidRegion(Coordinates(), output->info()->tensor_shape())); ICLKernel::configure(win); + + // Set config_id for enabling LWS tuning + _config_id = "depthwise_convolution3x3_"; + _config_id += lower_string(string_from_data_type(input->info()->data_type())); + _config_id += "_"; + _config_id += support::cpp11::to_string(input->info()->dimension(0)); + _config_id += "_"; + _config_id += support::cpp11::to_string(input->info()->dimension(1)); + _config_id += "_"; + _config_id += support::cpp11::to_string(input->info()->dimension(2)); + _config_id += "_"; + _config_id += support::cpp11::to_string(output->info()->dimension(0)); + _config_id += "_"; + _config_id += support::cpp11::to_string(output->info()->dimension(1)); } void CLDepthwiseConvolutionLayer3x3Kernel::run(const Window &window, cl::CommandQueue &queue) -- cgit v1.2.1