blob: cf6d4c9843532b81e3d2693e5e776e42cd3077d5 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001/*
Manuel Bottini8529bd62018-11-21 11:53:04 +00002 * Copyright (c) 2016-2019 ARM Limited.
Anthony Barbier6ff3b192017-09-04 18:44:23 +01003 *
4 * SPDX-License-Identifier: MIT
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to
8 * deal in the Software without restriction, including without limitation the
9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24#include "arm_compute/core/CL/CLKernelLibrary.h"
25
steniu0134702472017-07-11 09:22:58 +010026#include "arm_compute/core/CL/CLHelpers.h"
Anthony Barbier6ff3b192017-09-04 18:44:23 +010027#include "arm_compute/core/Error.h"
28#include "arm_compute/core/Utils.h"
29
steniu015f910722017-08-23 10:15:22 +010030#include <algorithm>
Anthony Barbier6ff3b192017-09-04 18:44:23 +010031#include <fstream>
32#include <iostream>
33#include <utility>
34#include <vector>
35
36using namespace arm_compute;
37
Georgios Pinitas388d3ec2017-11-02 12:17:56 +000038CLBuildOptions::CLBuildOptions()
39 : _build_opts()
40{
41}
42
43void CLBuildOptions::add_option(std::string option)
44{
45 _build_opts.emplace(std::move(option));
46}
47
48void CLBuildOptions::add_option_if(bool cond, std::string option)
49{
50 if(cond)
51 {
52 add_option(std::move(option));
53 }
54}
55
56void CLBuildOptions::add_option_if_else(bool cond, std::string option_true, std::string option_false)
57{
58 (cond) ? add_option(std::move(option_true)) : add_option(std::move(option_false));
59}
60
Chunosovf450caa2017-11-08 16:09:35 +070061void CLBuildOptions::add_options(const StringSet &options)
62{
63 _build_opts.insert(options.begin(), options.end());
64}
65
66void CLBuildOptions::add_options_if(bool cond, const StringSet &options)
67{
68 if(cond)
69 {
70 add_options(options);
71 }
72}
73
Chunosovd621bca2017-11-03 17:33:15 +070074const CLBuildOptions::StringSet &CLBuildOptions::options() const
Georgios Pinitas388d3ec2017-11-02 12:17:56 +000075{
76 return _build_opts;
77}
78
Anthony Barbier6ff3b192017-09-04 18:44:23 +010079Program::Program()
80 : _context(), _device(), _is_binary(false), _name(), _source(), _binary()
81{
82}
83
84Program::Program(cl::Context context, std::string name, std::string source)
85 : _context(std::move(context)), _device(), _is_binary(false), _name(std::move(name)), _source(std::move(source)), _binary()
86{
87}
88
89Program::Program(cl::Context context, cl::Device device, std::string name, std::vector<unsigned char> binary)
90 : _context(std::move(context)), _device(std::move(device)), _is_binary(true), _name(std::move(name)), _source(), _binary(std::move(binary))
91{
92}
93
94Program::operator cl::Program() const
95{
96 if(_is_binary)
97 {
98 return cl::Program(_context, { _device }, { _binary });
99 }
100 else
101 {
102 return cl::Program(_context, _source, false);
103 }
104}
105
106bool Program::build(const cl::Program &program, const std::string &build_options)
107{
108 try
109 {
110 return program.build(build_options.c_str()) == CL_SUCCESS;
111 }
112 catch(const cl::Error &e)
113 {
114 cl_int err = CL_SUCCESS;
115 const auto build_info = program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(&err);
116
117 for(auto &pair : build_info)
118 {
119 std::cerr << pair.second << std::endl;
120 }
121
122 return false;
123 }
124}
125
126cl::Program Program::build(const std::string &build_options) const
127{
128 cl::Program cl_program = static_cast<cl::Program>(*this);
129 build(cl_program, build_options);
130 return cl_program;
131}
132
133Kernel::Kernel()
134 : _name(), _kernel()
135{
136}
137
138Kernel::Kernel(std::string name, const cl::Program &program)
139 : _name(std::move(name)),
140 _kernel(cl::Kernel(program, _name.c_str()))
141{
142}
143
144const std::map<std::string, std::string> CLKernelLibrary::_kernel_program_map =
145{
146 { "absdiff", "absdiff.cl" },
147 { "accumulate", "accumulate.cl" },
148 { "accumulate_squared", "accumulate.cl" },
149 { "accumulate_weighted", "accumulate.cl" },
150 { "activation_layer", "activation_layer.cl" },
Michel Iwaniec00633802017-10-12 14:14:15 +0100151 { "activation_layer_qa8", "activation_layer_qa8.cl" },
Michele Di Giorgioe5bf4c52019-02-14 17:47:33 +0000152 { "activation_layer_logistic_qa8", "activation_layer_qa8.cl" },
Michalis Spyrouf1addb62018-09-11 11:16:47 +0100153 { "batch_to_space_nchw", "batch_to_space.cl" },
154 { "batch_to_space_static_nchw", "batch_to_space.cl" },
155 { "batch_to_space_nhwc", "batch_to_space.cl" },
156 { "batch_to_space_static_nhwc", "batch_to_space.cl" },
Michele Di Giorgiobf3c6622018-03-08 11:52:27 +0000157 { "batchnormalization_layer_nchw", "batchnormalization_layer.cl" },
158 { "batchnormalization_layer_nhwc", "batchnormalization_layer.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100159 { "bitwise_or", "bitwise_op.cl" },
160 { "bitwise_and", "bitwise_op.cl" },
161 { "bitwise_xor", "bitwise_op.cl" },
162 { "bitwise_not", "bitwise_op.cl" },
giuros01c04a0e82018-10-03 12:44:35 +0100163 { "bounding_box_transform", "bounding_box_transform.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100164 { "channel_combine_NV", "channel_combine.cl" },
165 { "channel_combine_RGB888", "channel_combine.cl" },
166 { "channel_combine_RGBA8888", "channel_combine.cl" },
167 { "channel_combine_UYVY422", "channel_combine.cl" },
168 { "channel_combine_YUYV422", "channel_combine.cl" },
Michele Di Giorgio72175632018-05-01 16:52:00 +0100169 { "channel_shuffle_nchw", "channel_shuffle.cl" },
Gian Marco Iodice8bab0ee2018-09-13 11:51:56 +0100170 { "channel_shuffle_nhwc", "channel_shuffle.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100171 { "channel_extract_NV12", "channel_extract.cl" },
172 { "channel_extract_NV21", "channel_extract.cl" },
173 { "channel_extract_RGB888", "channel_extract.cl" },
174 { "channel_extract_RGBA8888", "channel_extract.cl" },
175 { "channel_extract_UYVY422", "channel_extract.cl" },
176 { "channel_extract_YUYV422", "channel_extract.cl" },
177 { "combine_gradients_L1", "canny.cl" },
178 { "combine_gradients_L2", "canny.cl" },
Georgios Pinitas7900a9e2018-11-23 11:44:58 +0000179 { "compare_equal", "comparisons.cl" },
180 { "compare_equal_quantized", "comparisons.cl" },
181 { "compare_notequal", "comparisons.cl" },
182 { "compare_notequal_quantized", "comparisons.cl" },
183 { "compare_greater", "comparisons.cl" },
184 { "compare_greater_quantized", "comparisons.cl" },
185 { "compare_greaterequal", "comparisons.cl" },
186 { "compare_greaterequal_quantized", "comparisons.cl" },
187 { "compare_less", "comparisons.cl" },
188 { "compare_less_quantized", "comparisons.cl" },
189 { "compare_lessequal", "comparisons.cl" },
190 { "compare_lessequal_quantized", "comparisons.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100191 { "concatenate_depth", "concatenate.cl" },
Michalis Spyrou55b3d122018-05-09 09:59:23 +0100192 { "concatenate_width", "concatenate.cl" },
Pablo Tello6a14adb2019-03-05 17:33:08 +0000193 { "concatenate_height", "concatenate.cl" },
Michele Di Giorgio27400b92018-11-01 13:44:05 +0000194 { "concatenate_width_x2", "concatenate.cl" },
195 { "concatenate_width_x4", "concatenate.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100196 { "convolution_rectangle", "convolution_rectangle.cl" },
Gian Marco76faef82018-01-29 12:15:32 +0000197 { "col2im", "col2im.cl" },
Giorgio Arena657bdb32018-04-26 18:52:01 +0100198 { "convert_depth_down", "depth_convert.cl" },
199 { "convert_depth_up", "depth_convert.cl" },
200 { "convert_fc_weights", "convert_fc_weights.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100201 { "convolution3x3_static", "convolution3x3.cl" },
202 { "convolution5x5_static", "convolution5x5.cl" },
203 { "convolution7x7_static", "convolution7x7.cl" },
204 { "convolution9x9_static", "convolution9x9.cl" },
205 { "convolution_separable1x5_static", "convolution5x5.cl" },
206 { "convolution_separable5x1_static", "convolution5x5.cl" },
207 { "convolution_separable1x7_static", "convolution7x7.cl" },
208 { "convolution_separable7x1_static", "convolution7x7.cl" },
209 { "convolution_separable1x9_static", "convolution9x9.cl" },
210 { "convolution_separable9x1_static", "convolution9x9.cl" },
Michalis Spyrou5c8e05c2018-03-22 11:56:01 +0000211 { "copy_tensor", "copy_tensor.cl" },
Giuseppe Rossinid7647d42018-07-17 18:13:13 +0100212 { "copy_pad_tensor", "copy_tensor.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100213 { "copy_plane", "channel_extract.cl" },
214 { "copy_planes_3p", "channel_combine.cl" },
215 { "copy_to_keypoint", "fast_corners.cl" },
George Wort894066d2019-02-15 15:12:52 +0000216 { "crop_tensor", "crop_tensor.cl" },
Michalis Spyrou780db4e2017-11-23 09:49:51 +0000217 { "deconvolution_upsample", "deconvolution_layer.cl" },
Giorgio Arena93a690e2017-08-01 16:09:33 +0100218 { "depthwise_convolution_3x3", "depthwise_convolution.cl" },
Michele Di Giorgio933fe862018-02-19 15:42:12 +0000219 { "depthwise_convolution_3x3_f16", "depthwise_convolution.cl" },
Giorgio Arenad051e972018-06-20 11:46:42 +0100220 { "depthwise_convolution_3x3_nhwc", "depthwise_convolution.cl" },
221 { "depthwise_convolution_3x3_nhwc_stride1", "depthwise_convolution.cl" },
Georgios Pinitas0bc78492019-03-18 20:07:37 +0000222 { "digit_reverse", "fft.cl" },
Pablo Tello47104362019-02-27 13:32:51 +0000223 { "dwc_3x3_native_qasymm8_nchw", "depthwise_convolution_quantized.cl" },
224 { "dwc_3x3_native_qasymm8_dot8_nchw", "depthwise_convolution_quantized.cl" },
225 { "dwc_3x3_reshaped_qasymm8_nhwc", "depthwise_convolution_quantized.cl" },
226 { "dwc_3x3_reshaped_qasymm8_stride1_nhwc", "depthwise_convolution_quantized.cl" },
227 { "dwc_3x3_reshaped_qasymm8_dot8_stride1_nhwc", "depthwise_convolution_quantized.cl" },
Michele Di Giorgio3ebef322018-02-21 10:02:58 +0000228 { "depthwise_convolution_3x3_stridex1_stridey1_bifrost_f16", "depthwise_convolution.cl" },
229 { "depthwise_convolution_3x3_stridex2_stridey2_bifrost_f16", "depthwise_convolution.cl" },
230 { "depthwise_convolution_3x3_stridex1_stridey1_bifrost_f32", "depthwise_convolution.cl" },
231 { "depthwise_convolution_3x3_stridex2_stridey2_bifrost_f32", "depthwise_convolution.cl" },
giuros016d109962019-01-07 17:47:19 +0000232 { "depthwise_convolution_reshape_weights", "depthwise_convolution.cl" },
233 { "depthwise_convolution_reshape_weights_generic", "depthwise_convolution.cl" },
Giorgio Arena9fe41442017-08-23 16:36:24 +0100234 { "depthwise_im2col", "depthwise_convolution.cl" },
235 { "depthwise_vector_to_tensor", "depthwise_convolution.cl" },
Michele Di Giorgio56dd7262017-07-27 09:53:49 +0100236 { "dequantization_layer", "dequantization_layer.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100237 { "derivative", "derivative.cl" },
238 { "dilate", "dilate.cl" },
SiCong Lic51b72f2017-07-28 14:46:20 +0100239 { "direct_convolution1x1", "direct_convolution1x1.cl" },
Pablo Tello3d319462018-06-21 15:13:17 +0100240 { "direct_convolution1x1_nhwc", "direct_convolution1x1.cl" },
Gian Marco Iodice1c8409d2017-09-06 17:24:25 +0100241 { "direct_convolution1x1_f32_bifrost", "direct_convolution1x1.cl" },
SiCong Lic51b72f2017-07-28 14:46:20 +0100242 { "direct_convolution3x3", "direct_convolution3x3.cl" },
Pablo Tello3d319462018-06-21 15:13:17 +0100243 { "direct_convolution3x3_nhwc", "direct_convolution3x3.cl" },
Gian Marco Iodice1246b632017-08-16 18:38:32 +0100244 { "direct_convolution3x3_f32_bifrost", "direct_convolution3x3.cl" },
steniu01db006682017-08-09 16:26:22 +0100245 { "direct_convolution5x5", "direct_convolution5x5.cl" },
Pablo Tello3d319462018-06-21 15:13:17 +0100246 { "direct_convolution5x5_nhwc", "direct_convolution5x5.cl" },
Gian Marco Iodice1246b632017-08-16 18:38:32 +0100247 { "direct_convolution5x5_f32_bifrost", "direct_convolution5x5.cl" },
Chunosovd621bca2017-11-03 17:33:15 +0700248 { "direct_convolution_1x1_3x3_5x5_quantized", "direct_convolution_1x1_3x3_5x5_quantized.cl" },
giuros01164a2722018-11-20 18:34:46 +0000249 { "elementwise_operation_ADD", "elementwise_operation.cl" },
250 { "elementwise_operation_SUB", "elementwise_operation.cl" },
251 { "elementwise_operation_MAX", "elementwise_operation.cl" },
252 { "elementwise_operation_MIN", "elementwise_operation.cl" },
253 { "elementwise_operation_DIV", "elementwise_operation.cl" },
254 { "elementwise_operation_SQUARED_DIFF", "elementwise_operation.cl" },
255 { "elementwise_operation_ADD_quantized", "elementwise_operation_quantized.cl" },
256 { "elementwise_operation_SUB_quantized", "elementwise_operation_quantized.cl" },
257 { "elementwise_operation_MAX_quantized", "elementwise_operation_quantized.cl" },
258 { "elementwise_operation_MIN_quantized", "elementwise_operation_quantized.cl" },
259 { "elementwise_operation_DIV_quantized", "elementwise_operation_quantized.cl" },
260 { "elementwise_operation_SQUARED_DIFF_quantized", "elementwise_operation_quantized.cl" },
Michalis Spyroue9362622018-11-23 17:41:37 +0000261 { "elementwise_unary", "elementwise_unary.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100262 { "erode", "erode.cl" },
263 { "fast_corners", "fast_corners.cl" },
Georgios Pinitas0bc78492019-03-18 20:07:37 +0000264 { "fft_radix_2_first_stage_axis_0", "fft.cl" },
265 { "fft_radix_2_axis_0", "fft.cl" },
266 { "fft_radix_3_first_stage_axis_0", "fft.cl" },
267 { "fft_radix_3_axis_0", "fft.cl" },
268 { "fft_radix_4_first_stage_axis_0", "fft.cl" },
269 { "fft_radix_4_axis_0", "fft.cl" },
270 { "fft_radix_5_first_stage_axis_0", "fft.cl" },
271 { "fft_radix_5_axis_0", "fft.cl" },
272 { "fft_radix_7_first_stage_axis_0", "fft.cl" },
273 { "fft_radix_7_axis_0", "fft.cl" },
274 { "fft_radix_8_first_stage_axis_0", "fft.cl" },
275 { "fft_radix_8_axis_0", "fft.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100276 { "fill_image_borders_constant", "fill_border.cl" },
277 { "fill_image_borders_replicate", "fill_border.cl" },
278 { "finalize", "optical_flow_pyramid_lk.cl" },
Georgios Pinitas0bc78492019-03-18 20:07:37 +0000279 { "flatten", "flatten.cl" },
Georgios Pinitasd8e765b2017-08-02 13:44:33 +0100280 { "floor_layer", "floor.cl" },
Georgios Pinitas0bc78492019-03-18 20:07:37 +0000281 { "fuse_batchnormalization_layer", "batchnormalization_layer.cl" },
Manuel Bottini8529bd62018-11-21 11:53:04 +0000282 { "gather", "gather.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100283 { "gaussian1x5_sub_x", "gaussian_pyramid.cl" },
284 { "gaussian5x1_sub_y", "gaussian_pyramid.cl" },
Gian Marco Iodice578ab612017-06-23 09:34:33 +0100285 { "gemm_accumulate_biases", "gemm.cl" },
Gian Marco36a0a462018-01-12 10:21:40 +0000286 { "gemm_interleave4x4", "gemm.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100287 { "gemm_ma_f16", "gemm.cl" },
288 { "gemm_ma_f32", "gemm.cl" },
Giorgio Arena9fe41442017-08-23 16:36:24 +0100289 { "gemm_mv", "gemv.cl" },
Georgios Pinitasde5a1cc2018-02-02 12:52:07 +0000290 { "gemm_mv_quantized", "gemv.cl" },
Gian Marco Iodiceedfa9f42017-08-15 11:45:22 +0100291 { "gemm_mm_interleaved_transposed_f16", "gemm.cl" },
Vidhya Sudhan Loganathan38d93bd2018-11-20 15:38:13 +0000292 { "gemm_mm_interleaved_transposed_f16_acc32", "gemm.cl" },
Gian Marco Iodicebb36a8e2018-04-19 12:05:08 +0100293 { "gemm_mm_interleaved_transposed_f16_bifrost", "gemm.cl" },
294 { "gemm_mm_interleaved_transposed_f32", "gemm.cl" },
Gian Marco Iodiceedfa9f42017-08-15 11:45:22 +0100295 { "gemm_mm_interleaved_transposed_f32_bifrost", "gemm.cl" },
Gian Marco Iodiceedfa9f42017-08-15 11:45:22 +0100296 { "gemm_mm_floating_point", "gemm.cl" },
Gian Marco Iodicefd683112018-04-17 09:52:44 +0100297 { "gemm_mm_floating_point_f16_bifrost", "gemm.cl" },
Vidhya Sudhan Loganathana25d16c2018-11-16 11:33:12 +0000298 { "gemm_mm_floating_point_f16_bifrost_acc32", "gemm.cl" },
Anton Lokhmotov3e80c7f2017-11-20 11:02:10 +0000299 { "gemm_mm_floating_point_f32_bifrost", "gemm.cl" },
300 { "gemm_mm_floating_point_f32_bifrost_1000", "gemm.cl" },
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000301 { "gemm_mm_reshaped_lhs_nt_rhs_t", "gemm.cl" },
Gian Marco Iodiceba5e0962019-03-11 12:17:44 +0000302 { "gemm_mm_reshaped_only_rhs_nt", "gemm.cl" },
Gian Marco Iodiceadc53952019-02-15 11:10:31 +0000303 { "gemm_mm_reshaped_only_rhs_t", "gemm.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100304 { "gemm_lc_vm_f32", "gemm.cl" },
Gian Marco36a0a462018-01-12 10:21:40 +0000305 { "gemm_transpose1xW", "gemm.cl" },
Gian Marco Iodice5ba5e092018-12-06 17:13:09 +0000306 { "gemm_reshape_lhs_matrix_nt", "gemm.cl" },
Gian Marco Iodice08ddd7b2018-12-19 10:01:18 +0000307 { "gemm_reshape_lhs_matrix_t", "gemm.cl" },
Gian Marco Iodice3b0a2652018-12-07 11:18:09 +0000308 { "gemm_reshape_rhs_matrix_nt", "gemm.cl" },
309 { "gemm_reshape_rhs_matrix_t", "gemm.cl" },
Gian Marco05288a22017-11-21 10:57:50 +0000310 { "gemmlowp_matrix_a_reduction", "gemmlowp.cl" },
Gian Marco Iodice4b908652018-10-18 10:21:02 +0100311 { "gemmlowp_matrix_a_reduction_dot8", "gemmlowp.cl" },
Gian Marco05288a22017-11-21 10:57:50 +0000312 { "gemmlowp_matrix_b_reduction", "gemmlowp.cl" },
Gian Marco7b4d5472018-01-10 15:56:30 +0000313 { "gemmlowp_mm_bifrost", "gemmlowp.cl" },
Giorgio Arena6200fa42018-07-06 17:06:36 +0100314 { "gemmlowp_mm_bifrost_dot8", "gemmlowp.cl" },
Gian Marco7b4d5472018-01-10 15:56:30 +0000315 { "gemmlowp_mm_midgard", "gemmlowp.cl" },
Gian Marco19835e52018-01-30 13:35:54 +0000316 { "gemmlowp_mm_interleaved_transposed_bifrost", "gemmlowp.cl" },
Giorgio Arena6200fa42018-07-06 17:06:36 +0100317 { "gemmlowp_mm_interleaved_transposed_bifrost_dot8", "gemmlowp.cl" },
Gian Marco19835e52018-01-30 13:35:54 +0000318 { "gemmlowp_mm_interleaved_transposed_midgard", "gemmlowp.cl" },
Gian Marco Iodicedb63b9c2019-01-17 09:47:04 +0000319 { "gemmlowp_mm_reshaped_lhs_nt_rhs_t", "gemmlowp.cl" },
320 { "gemmlowp_mm_reshaped_lhs_nt_rhs_t_dot8", "gemmlowp.cl" },
Gian Marco Iodice62251f72019-03-11 16:07:12 +0000321 { "gemmlowp_mm_reshaped_only_rhs_t", "gemmlowp.cl" },
Gian Marco05288a22017-11-21 10:57:50 +0000322 { "gemmlowp_offset_contribution", "gemmlowp.cl" },
Gian Marco Iodice4b908652018-10-18 10:21:02 +0100323 { "gemmlowp_offset_contribution_quantize_down", "gemmlowp.cl" },
324 { "gemmlowp_offset_contribution_quantize_down_fixedpoint", "gemmlowp.cl" },
Gian Marco05288a22017-11-21 10:57:50 +0000325 { "gemmlowp_output_stage_quantize_down", "gemmlowp.cl" },
Gian Marco58c57942017-11-28 09:10:03 +0000326 { "gemmlowp_output_stage_quantize_down_fixedpoint", "gemmlowp.cl" },
Georgios Pinitas51e53a32018-10-22 13:49:08 +0100327 { "gemmlowp_output_stage_quantize_down_float", "gemmlowp.cl" },
Manuel Bottini5209be52019-02-13 16:34:56 +0000328 { "generate_proposals_compute_all_anchors", "generate_proposals.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100329 { "harris_score_3x3", "harris_corners.cl" },
330 { "harris_score_5x5", "harris_corners.cl" },
331 { "harris_score_7x7", "harris_corners.cl" },
332 { "hist_border_kernel", "histogram.cl" },
333 { "hist_border_kernel_fixed", "histogram.cl" },
334 { "hist_local_kernel", "histogram.cl" },
335 { "hist_local_kernel_fixed", "histogram.cl" },
336 { "hog_block_normalization", "hog.cl" },
337 { "hog_detector", "hog.cl" },
338 { "hog_orientation_binning", "hog.cl" },
339 { "hysteresis", "canny.cl" },
Gian Marco Iodice215b4ea2018-06-28 16:29:29 +0100340 { "im2col1x1_stridex1_nchw", "im2col.cl" },
341 { "im2col3x3_nchw", "im2col.cl" },
342 { "im2col5x5_nchw", "im2col.cl" },
343 { "im2col11x11_padx0_pady0_nchw", "im2col.cl" },
344 { "im2col_generic_nchw", "im2col.cl" },
345 { "im2col_generic_padx0_pady0_nchw", "im2col.cl" },
Pablo Tello4a626a72018-04-04 10:01:14 +0100346 { "im2col3x3_nhwc", "im2col.cl" },
Gian Marco Iodicebf9731e2018-12-12 10:18:04 +0000347 { "im2col9x9_nhwc", "im2col.cl" },
Pablo Tello4a626a72018-04-04 10:01:14 +0100348 { "im2col_generic_nhwc", "im2col.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100349 { "init_level", "optical_flow_pyramid_lk.cl" },
350 { "init_level_max", "optical_flow_pyramid_lk.cl" },
351 { "init_level_max_initial_estimate", "optical_flow_pyramid_lk.cl" },
352 { "integral_horizontal", "integral_image.cl" },
353 { "integral_vertical", "integral_image.cl" },
354 { "IYUV_to_NV12_bt709", "color_convert.cl" },
355 { "IYUV_to_RGB888_bt709", "color_convert.cl" },
356 { "IYUV_to_RGBA8888_bt709", "color_convert.cl" },
357 { "IYUV_to_YUV444_bt709", "color_convert.cl" },
Michalis Spyrou5538d342018-11-14 08:10:13 +0000358 { "l2_normalize_x", "l2_normalize.cl" },
359 { "l2_normalize_y", "l2_normalize.cl" },
360 { "l2_normalize_z", "l2_normalize.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100361 { "lktracker_stage0", "optical_flow_pyramid_lk.cl" },
362 { "lktracker_stage1", "optical_flow_pyramid_lk.cl" },
363 { "magnitude_phase", "magnitude_phase.cl" },
364 { "mean_stddev_accumulate", "mean_stddev.cl" },
Giuseppe Rossinid7647d42018-07-17 18:13:13 +0100365 { "memset", "memset.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100366 { "minmax", "minmaxloc.cl" },
367 { "minmax_border", "minmaxloc.cl" },
Michele Di Giorgio56dd7262017-07-27 09:53:49 +0100368 { "minmax_layer", "minmax_layer.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100369 { "minmaxloc", "minmaxloc.cl" },
370 { "non_linear_filter_box3x3", "non_linear_filter3x3.cl" },
371 { "non_linear_filter_cross3x3", "non_linear_filter3x3.cl" },
372 { "non_linear_filter_disk3x3", "non_linear_filter3x3.cl" },
373 { "non_linear_filter_box5x5", "non_linear_filter5x5.cl" },
374 { "non_linear_filter_cross5x5", "non_linear_filter5x5.cl" },
375 { "non_linear_filter_disk5x5", "non_linear_filter5x5.cl" },
376 { "non_max_suppression", "nonmax.cl" },
377 { "normalization_layer_cross_map", "normalization_layer.cl" },
Michele Di Giorgio9d3a8312018-11-20 12:31:24 +0000378 { "normalization_layer_in_map_nchw", "normalization_layer.cl" },
379 { "normalization_layer_in_map_nhwc", "normalization_layer.cl" },
Michele Di Giorgiob57be0d2018-08-31 16:26:25 +0100380 { "normalize_planar_yuv_layer_nchw", "normalize_planar_yuv_layer.cl" },
381 { "normalize_planar_yuv_layer_nhwc", "normalize_planar_yuv_layer.cl" },
Michele Di Giorgiod63dfa22018-09-12 10:18:54 +0100382 { "normalize_planar_yuv_layer_q8_nchw", "normalize_planar_yuv_layer_quantized.cl" },
383 { "normalize_planar_yuv_layer_q8_nhwc", "normalize_planar_yuv_layer_quantized.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100384 { "NV12_to_IYUV_bt709", "color_convert.cl" },
385 { "NV12_to_RGB888_bt709", "color_convert.cl" },
386 { "NV12_to_RGBA8888_bt709", "color_convert.cl" },
387 { "NV12_to_YUV444_bt709", "color_convert.cl" },
388 { "NV21_to_IYUV_bt709", "color_convert.cl" },
389 { "NV21_to_RGB888_bt709", "color_convert.cl" },
390 { "NV21_to_RGBA8888_bt709", "color_convert.cl" },
391 { "NV21_to_YUV444_bt709", "color_convert.cl" },
Giorgio Arenaa086a0a2018-02-16 12:42:16 +0000392 { "output_stage_quantized", "direct_convolution_1x1_3x3_5x5_quantized.cl" },
shubhame1a4e372019-01-07 21:37:55 +0530393 { "permute", "permute.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100394 { "pixelwise_mul_float", "pixelwise_mul_float.cl" },
395 { "pixelwise_mul_int", "pixelwise_mul_int.cl" },
Georgios Pinitasbf28a3c2018-09-18 14:34:48 +0100396 { "pixelwise_mul_quantized", "pixelwise_mul_int.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100397 { "pooling_layer_2", "pooling_layer.cl" },
398 { "pooling_layer_3", "pooling_layer.cl" },
Anton Lokhmotovaf6204c2017-11-08 09:34:19 +0000399 { "pooling_layer_optimized_3", "pooling_layer.cl" },
Georgios Pinitasce093142017-06-19 16:11:53 +0100400 { "pooling_layer_7", "pooling_layer.cl" },
Michalis Spyroue74b2012018-04-18 09:49:16 +0100401 { "pooling_layer_MxN_nchw", "pooling_layer.cl" },
402 { "pooling_layer_MxN_nhwc", "pooling_layer.cl" },
403 { "pooling_layer_MxN_quantized_nhwc", "pooling_layer_quantized.cl" },
404 { "pooling_layer_MxN_quantized_nchw", "pooling_layer_quantized.cl" },
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +0100405 { "prior_box_layer_nchw", "prior_box_layer.cl" },
Michele Di Giorgio56dd7262017-07-27 09:53:49 +0100406 { "quantization_layer", "quantization_layer.cl" },
Vidhya Sudhan Loganathan5e96be72018-12-18 14:17:00 +0000407 { "range", "range.cl" },
408 { "range_quantized", "range.cl" },
Michalis Spyrou7e9391b2018-10-05 14:49:28 +0100409 { "reduction_operation_x", "reduction_operation.cl" },
Michalis Spyrou7930db42018-11-22 17:36:28 +0000410 { "reduction_operation_non_parallel_x", "reduction_operation.cl" },
Michalis Spyrou7e9391b2018-10-05 14:49:28 +0100411 { "reduction_operation_y", "reduction_operation.cl" },
412 { "reduction_operation_z", "reduction_operation.cl" },
413 { "reduction_operation_w", "reduction_operation.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100414 { "remap_nearest_neighbour", "remap.cl" },
415 { "remap_bilinear", "remap.cl" },
Gian Marco Iodice477531c2018-08-21 17:53:38 +0100416 { "reorg_layer_nchw", "reorg_layer.cl" },
417 { "reorg_layer_nhwc", "reorg_layer.cl" },
Georgios Pinitas5ee66ea2017-09-07 17:29:16 +0100418 { "reshape_layer", "reshape_layer.cl" },
Gian Marco Iodice215b4ea2018-06-28 16:29:29 +0100419 { "reshape_to_columns", "convolution_layer.cl" },
Michele Di Giorgio5daeffd2018-11-26 10:01:15 +0000420 { "reverse", "reverse.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100421 { "RGB888_to_IYUV_bt709", "color_convert.cl" },
422 { "RGB888_to_NV12_bt709", "color_convert.cl" },
423 { "RGB888_to_RGBA8888_bt709", "color_convert.cl" },
Manuel Bottiniacaf21d2018-09-26 17:38:19 +0100424 { "RGB888_to_U8_bt709", "color_convert.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100425 { "RGB888_to_YUV444_bt709", "color_convert.cl" },
426 { "RGBA8888_to_IYUV_bt709", "color_convert.cl" },
427 { "RGBA8888_to_NV12_bt709", "color_convert.cl" },
428 { "RGBA8888_to_RGB888_bt709", "color_convert.cl" },
429 { "RGBA8888_to_YUV444_bt709", "color_convert.cl" },
giuros0118870812018-09-13 09:31:40 +0100430 { "roi_align_layer", "roi_align_layer.cl" },
SiCong Li3e363692017-07-04 15:02:10 +0100431 { "roi_pooling_layer", "roi_pooling_layer.cl" },
Michalis Spyrou46da23f2018-04-10 13:41:30 +0100432 { "scale_nearest_neighbour_nchw", "scale.cl" },
433 { "scale_nearest_neighbour_nhwc", "scale.cl" },
434 { "scale_bilinear_nchw", "scale.cl" },
435 { "scale_bilinear_nhwc", "scale.cl" },
Michalis Spyrou17220e22018-09-12 13:35:38 +0100436 { "scale_bilinear_quantized_nchw", "scale_quantized.cl" },
437 { "scale_bilinear_quantized_nhwc", "scale_quantized.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100438 { "scharr3x3", "scharr_filter.cl" },
Georgios Pinitasaaa27182018-11-21 16:32:15 +0000439 { "select_same_rank", "select.cl" },
440 { "select_different_rank_2", "select.cl" },
441 { "select_different_rank_n", "select.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100442 { "sobel3x3", "sobel_filter.cl" },
443 { "sobel_separable5x1", "sobel_filter.cl" },
444 { "sobel_separable1x5", "sobel_filter.cl" },
445 { "sobel_separable7x1", "sobel_filter.cl" },
446 { "sobel_separable1x7", "sobel_filter.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100447 { "softmax_layer_norm", "softmax_layer.cl" },
Chunosovf450caa2017-11-08 16:09:35 +0700448 { "softmax_layer_norm_quantized", "softmax_layer_quantized.cl" },
Giorgio Arena4402cb92018-02-15 13:37:40 +0000449 { "softmax_layer_max_shift_exp_sum_quantized_serial", "softmax_layer_quantized.cl" },
450 { "softmax_layer_max_shift_exp_sum_quantized_parallel", "softmax_layer_quantized.cl" },
Chunosovd6afedc2017-11-06 22:09:45 +0700451 { "softmax_layer_max_shift_exp_sum_serial", "softmax_layer.cl" },
Michalis Spyrou13a51e12018-09-18 13:09:30 +0100452 { "space_to_batch_nchw", "space_to_batch.cl" },
453 { "space_to_batch_static_nchw", "space_to_batch.cl" },
454 { "space_to_batch_nhwc", "space_to_batch.cl" },
455 { "space_to_batch_static_nhwc", "space_to_batch.cl" },
Chunosovd6afedc2017-11-06 22:09:45 +0700456 { "softmax_layer_max_shift_exp_sum_parallel", "softmax_layer.cl" },
Gian Marco Iodice8aa985e2018-11-27 15:58:08 +0000457 { "stack_layer", "stack_layer.cl" },
Georgios Pinitasc1a72452018-08-24 11:25:32 +0100458 { "strided_slice", "slice_ops.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100459 { "suppress_non_maximum", "canny.cl" },
460 { "tablelookup_U8", "tablelookup.cl" },
461 { "tablelookup_S16", "tablelookup.cl" },
462 { "threshold_binary", "threshold.cl" },
463 { "threshold_range", "threshold.cl" },
giuros013175fcf2018-11-21 09:59:17 +0000464 { "tile", "tile.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100465 { "transpose", "transpose.cl" },
466 { "UYVY422_to_IYUV_bt709", "color_convert.cl" },
467 { "UYVY422_to_NV12_bt709", "color_convert.cl" },
468 { "UYVY422_to_RGB888_bt709", "color_convert.cl" },
469 { "UYVY422_to_RGBA8888_bt709", "color_convert.cl" },
Michalis Spyrouceb889e2018-09-17 18:24:41 +0100470 { "upsample_layer_nchw", "upsample_layer.cl" },
471 { "upsample_layer_nhwc", "upsample_layer.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100472 { "warp_affine_nearest_neighbour", "warp_affine.cl" },
473 { "warp_affine_bilinear", "warp_affine.cl" },
474 { "warp_perspective_nearest_neighbour", "warp_perspective.cl" },
475 { "warp_perspective_bilinear", "warp_perspective.cl" },
Giorgio Arenaa50e5e02018-07-02 13:42:23 +0100476 { "winograd_filter_transform_2x2_3x3_nchw", "winograd_filter_transform.cl" },
477 { "winograd_filter_transform_2x1_3x1_nchw", "winograd_filter_transform.cl" },
478 { "winograd_filter_transform_1x2_1x3_nchw", "winograd_filter_transform.cl" },
479 { "winograd_filter_transform_4x4_3x3_nchw", "winograd_filter_transform.cl" },
480 { "winograd_filter_transform_4x1_3x1_nchw", "winograd_filter_transform.cl" },
481 { "winograd_filter_transform_1x4_1x3_nchw", "winograd_filter_transform.cl" },
482 { "winograd_filter_transform_4x4_5x5_nchw", "winograd_filter_transform.cl" },
Gian Marco Iodice876be2a2018-07-03 12:22:09 +0100483 { "winograd_filter_transform_4x1_5x1_nchw", "winograd_filter_transform.cl" },
484 { "winograd_filter_transform_1x4_1x5_nchw", "winograd_filter_transform.cl" },
Giorgio Arena149fdf32018-07-04 17:03:33 +0100485 { "winograd_filter_transform_4x1_3x1_nhwc", "winograd_filter_transform.cl" },
486 { "winograd_filter_transform_1x4_1x3_nhwc", "winograd_filter_transform.cl" },
Giorgio Arenaa50e5e02018-07-02 13:42:23 +0100487 { "winograd_filter_transform_4x4_3x3_nhwc", "winograd_filter_transform.cl" },
488 { "winograd_filter_transform_4x4_5x5_nhwc", "winograd_filter_transform.cl" },
Gian Marco Iodiced28b7512018-07-06 12:59:28 +0100489 { "winograd_filter_transform_4x1_5x1_nhwc", "winograd_filter_transform.cl" },
490 { "winograd_filter_transform_1x4_1x5_nhwc", "winograd_filter_transform.cl" },
Michele Di Giorgio881c6842019-02-27 14:26:51 +0000491 { "winograd_filter_transform_2x2_7x7_nhwc", "winograd_filter_transform.cl" },
492 { "winograd_filter_transform_2x1_7x1_nhwc", "winograd_filter_transform.cl" },
493 { "winograd_filter_transform_1x2_1x7_nhwc", "winograd_filter_transform.cl" },
Giorgio Arenaa50e5e02018-07-02 13:42:23 +0100494 { "winograd_input_transform_2x2_3x3_stepz1_nchw", "winograd_input_transform.cl" },
495 { "winograd_input_transform_2x2_3x3_stepz2_nchw", "winograd_input_transform.cl" },
496 { "winograd_input_transform_2x1_3x1_stepz1_nchw", "winograd_input_transform.cl" },
497 { "winograd_input_transform_2x1_3x1_stepz2_nchw", "winograd_input_transform.cl" },
498 { "winograd_input_transform_1x2_1x3_stepz1_nchw", "winograd_input_transform.cl" },
499 { "winograd_input_transform_1x2_1x3_stepz2_nchw", "winograd_input_transform.cl" },
500 { "winograd_input_transform_4x4_3x3_stepz1_nchw", "winograd_input_transform.cl" },
501 { "winograd_input_transform_4x1_3x1_stepz1_nchw", "winograd_input_transform.cl" },
502 { "winograd_input_transform_1x4_1x3_stepz1_nchw", "winograd_input_transform.cl" },
503 { "winograd_input_transform_4x4_5x5_stepz1_nchw", "winograd_input_transform.cl" },
Gian Marco Iodice876be2a2018-07-03 12:22:09 +0100504 { "winograd_input_transform_4x1_5x1_stepz1_nchw", "winograd_input_transform.cl" },
505 { "winograd_input_transform_1x4_1x5_stepz1_nchw", "winograd_input_transform.cl" },
Giorgio Arena149fdf32018-07-04 17:03:33 +0100506 { "winograd_input_transform_4x1_3x1_stepz1_nhwc", "winograd_input_transform.cl" },
507 { "winograd_input_transform_1x4_1x3_stepz1_nhwc", "winograd_input_transform.cl" },
Giorgio Arenaa50e5e02018-07-02 13:42:23 +0100508 { "winograd_input_transform_4x4_3x3_stepz1_nhwc", "winograd_input_transform.cl" },
509 { "winograd_input_transform_4x4_5x5_stepz1_nhwc", "winograd_input_transform.cl" },
Gian Marco Iodiced28b7512018-07-06 12:59:28 +0100510 { "winograd_input_transform_4x1_5x1_stepz1_nhwc", "winograd_input_transform.cl" },
511 { "winograd_input_transform_1x4_1x5_stepz1_nhwc", "winograd_input_transform.cl" },
Michele Di Giorgiof955d512019-02-27 14:26:51 +0000512 { "winograd_input_transform_2x2_7x7_stepz1_nhwc", "winograd_input_transform.cl" },
513 { "winograd_input_transform_2x1_7x1_stepz1_nhwc", "winograd_input_transform.cl" },
514 { "winograd_input_transform_1x2_1x7_stepz1_nhwc", "winograd_input_transform.cl" },
Giorgio Arenaa50e5e02018-07-02 13:42:23 +0100515 { "winograd_output_transform_2x2_3x3_nchw", "winograd_output_transform.cl" },
516 { "winograd_output_transform_2x1_3x1_nchw", "winograd_output_transform.cl" },
517 { "winograd_output_transform_1x2_1x3_nchw", "winograd_output_transform.cl" },
518 { "winograd_output_transform_4x4_3x3_nchw", "winograd_output_transform.cl" },
519 { "winograd_output_transform_4x1_3x1_nchw", "winograd_output_transform.cl" },
520 { "winograd_output_transform_1x4_1x3_nchw", "winograd_output_transform.cl" },
521 { "winograd_output_transform_4x4_5x5_nchw", "winograd_output_transform.cl" },
Gian Marco Iodice876be2a2018-07-03 12:22:09 +0100522 { "winograd_output_transform_4x1_5x1_nchw", "winograd_output_transform.cl" },
523 { "winograd_output_transform_1x4_1x5_nchw", "winograd_output_transform.cl" },
Giorgio Arena149fdf32018-07-04 17:03:33 +0100524 { "winograd_output_transform_4x1_3x1_nhwc", "winograd_output_transform.cl" },
525 { "winograd_output_transform_1x4_1x3_nhwc", "winograd_output_transform.cl" },
Giorgio Arenaa50e5e02018-07-02 13:42:23 +0100526 { "winograd_output_transform_4x4_3x3_nhwc", "winograd_output_transform.cl" },
527 { "winograd_output_transform_4x4_5x5_nhwc", "winograd_output_transform.cl" },
Gian Marco Iodiced28b7512018-07-06 12:59:28 +0100528 { "winograd_output_transform_4x1_5x1_nhwc", "winograd_output_transform.cl" },
529 { "winograd_output_transform_1x4_1x5_nhwc", "winograd_output_transform.cl" },
Giorgio Arena73023022018-09-04 14:55:55 +0100530 { "yolo_layer_nchw", "yolo_layer.cl" },
531 { "yolo_layer_nhwc", "yolo_layer.cl" },
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100532 { "YUYV422_to_IYUV_bt709", "color_convert.cl" },
533 { "YUYV422_to_NV12_bt709", "color_convert.cl" },
534 { "YUYV422_to_RGB888_bt709", "color_convert.cl" },
535 { "YUYV422_to_RGBA8888_bt709", "color_convert.cl" },
536};
537
538const std::map<std::string, std::string> CLKernelLibrary::_program_source_map =
539{
540#ifdef EMBEDDED_KERNELS
541 {
542 "absdiff.cl",
543#include "./cl_kernels/absdiff.clembed"
544 },
545 {
546 "accumulate.cl",
547#include "./cl_kernels/accumulate.clembed"
548 },
549 {
550 "activation_layer.cl",
551#include "./cl_kernels/activation_layer.clembed"
552 },
553 {
Michel Iwaniec00633802017-10-12 14:14:15 +0100554 "activation_layer_qa8.cl",
555#include "./cl_kernels/activation_layer_qa8.clembed"
556 },
557 {
Michalis Spyrou6a8d3b62018-08-31 10:07:09 +0100558 "batch_to_space.cl",
559#include "./cl_kernels/batch_to_space.clembed"
560 },
561 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100562 "bitwise_op.cl",
563#include "./cl_kernels/bitwise_op.clembed"
564 },
565 {
giuros01c04a0e82018-10-03 12:44:35 +0100566 "bounding_box_transform.cl",
567#include "./cl_kernels/bounding_box_transform.clembed"
568 },
569 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100570 "canny.cl",
571#include "./cl_kernels/canny.clembed"
572 },
573 {
574 "channel_combine.cl",
575#include "./cl_kernels/channel_combine.clembed"
576 },
577 {
578 "channel_extract.cl",
579#include "./cl_kernels/channel_extract.clembed"
580 },
581 {
Michele Di Giorgio72175632018-05-01 16:52:00 +0100582 "channel_shuffle.cl",
583#include "./cl_kernels/channel_shuffle.clembed"
584 },
585 {
Gian Marco76faef82018-01-29 12:15:32 +0000586 "col2im.cl",
587#include "./cl_kernels/col2im.clembed"
588 },
589 {
Georgios Pinitas7900a9e2018-11-23 11:44:58 +0000590 "comparisons.cl",
591#include "./cl_kernels/comparisons.clembed"
592 },
593 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100594 "concatenate.cl",
595#include "./cl_kernels/concatenate.clembed"
596 },
597 {
598 "color_convert.cl",
599#include "./cl_kernels/color_convert.clembed"
600 },
601 {
Giorgio Arena657bdb32018-04-26 18:52:01 +0100602 "convert_fc_weights.cl",
603#include "./cl_kernels/convert_fc_weights.clembed"
604 },
605 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100606 "convolution3x3.cl",
607#include "./cl_kernels/convolution3x3.clembed"
608 },
609 {
610 "convolution5x5.cl",
611#include "./cl_kernels/convolution5x5.clembed"
612 },
613 {
614 "convolution7x7.cl",
615#include "./cl_kernels/convolution7x7.clembed"
616 },
617 {
618 "convolution9x9.cl",
619#include "./cl_kernels/convolution9x9.clembed"
620 },
621 {
622 "convolution_layer.cl",
623#include "./cl_kernels/convolution_layer.clembed"
624 },
625 {
626 "convolution_rectangle.cl",
627#include "./cl_kernels/convolution_rectangle.clembed"
628 },
629 {
Michalis Spyrou5c8e05c2018-03-22 11:56:01 +0000630 "copy_tensor.cl",
631#include "./cl_kernels/copy_tensor.clembed"
632 },
633 {
George Wort894066d2019-02-15 15:12:52 +0000634 "crop_tensor.cl",
635#include "./cl_kernels/crop_tensor.clembed"
636 },
637 {
Michalis Spyrouceb889e2018-09-17 18:24:41 +0100638 "upsample_layer.cl",
639#include "./cl_kernels/upsample_layer.clembed"
640 },
641 {
Michalis Spyrou780db4e2017-11-23 09:49:51 +0000642 "deconvolution_layer.cl",
643#include "./cl_kernels/deconvolution_layer.clembed"
644 },
645 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100646 "depth_convert.cl",
647#include "./cl_kernels/depth_convert.clembed"
648 },
649 {
Giorgio Arena93a690e2017-08-01 16:09:33 +0100650 "depthwise_convolution.cl",
651#include "./cl_kernels/depthwise_convolution.clembed"
652 },
653 {
Dmitry Savenkod7295b72017-11-20 22:00:08 +0700654 "depthwise_convolution_quantized.cl",
655#include "./cl_kernels/depthwise_convolution_quantized.clembed"
656 },
657 {
Michele Di Giorgio56dd7262017-07-27 09:53:49 +0100658 "dequantization_layer.cl",
659#include "./cl_kernels/dequantization_layer.clembed"
660 },
661 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100662 "derivative.cl",
663#include "./cl_kernels/derivative.clembed"
664 },
665 {
666 "dilate.cl",
667#include "./cl_kernels/dilate.clembed"
668 },
669 {
SiCong Lic51b72f2017-07-28 14:46:20 +0100670 "direct_convolution1x1.cl",
671#include "./cl_kernels/direct_convolution1x1.clembed"
672 },
673 {
674 "direct_convolution3x3.cl",
675#include "./cl_kernels/direct_convolution3x3.clembed"
steniu0127b386c2017-07-18 17:37:43 +0100676 },
677 {
steniu01db006682017-08-09 16:26:22 +0100678 "direct_convolution5x5.cl",
679#include "./cl_kernels/direct_convolution5x5.clembed"
680 },
681 {
Chunosovd621bca2017-11-03 17:33:15 +0700682 "direct_convolution_1x1_3x3_5x5_quantized.cl",
683#include "./cl_kernels/direct_convolution_1x1_3x3_5x5_quantized.clembed"
684 },
685 {
giuros01164a2722018-11-20 18:34:46 +0000686 "elementwise_operation.cl",
687#include "./cl_kernels/elementwise_operation.clembed"
688 },
689 {
690 "elementwise_operation_quantized.cl",
691#include "./cl_kernels/elementwise_operation_quantized.clembed"
692 },
693 {
Michalis Spyroue9362622018-11-23 17:41:37 +0000694 "elementwise_unary.cl",
695#include "./cl_kernels/elementwise_unary.clembed"
696 },
697 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100698 "erode.cl",
699#include "./cl_kernels/erode.clembed"
700 },
701 {
702 "fast_corners.cl",
703#include "./cl_kernels/fast_corners.clembed"
704 },
705 {
Georgios Pinitas0bc78492019-03-18 20:07:37 +0000706 "fft.cl",
707#include "./cl_kernels/fft.clembed"
Gian Marco Iodice215b4ea2018-06-28 16:29:29 +0100708 },
709 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100710 "fill_border.cl",
711#include "./cl_kernels/fill_border.clembed"
712 },
713 {
Georgios Pinitas0bc78492019-03-18 20:07:37 +0000714 "flatten.cl",
715#include "./cl_kernels/flatten.clembed"
716 },
717 {
Georgios Pinitasd8e765b2017-08-02 13:44:33 +0100718 "floor.cl",
719#include "./cl_kernels/floor.clembed"
720 },
721 {
Manuel Bottini8529bd62018-11-21 11:53:04 +0000722 "gather.cl",
723#include "./cl_kernels/gather.clembed"
724 },
725 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100726 "gaussian_pyramid.cl",
727#include "./cl_kernels/gaussian_pyramid.clembed"
728 },
729 {
730 "gemm.cl",
731#include "./cl_kernels/gemm.clembed"
732 },
733 {
Gian Marco05288a22017-11-21 10:57:50 +0000734 "gemmlowp.cl",
735#include "./cl_kernels/gemmlowp.clembed"
736 },
737 {
Giorgio Arena9fe41442017-08-23 16:36:24 +0100738 "gemv.cl",
739#include "./cl_kernels/gemv.clembed"
740 },
741 {
Manuel Bottini5209be52019-02-13 16:34:56 +0000742 "generate_proposals.cl",
743#include "./cl_kernels/generate_proposals.clembed"
744 },
745 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100746 "harris_corners.cl",
747#include "./cl_kernels/harris_corners.clembed"
748 },
749 {
750 "helpers.h",
751#include "./cl_kernels/helpers.hembed"
752 },
753 {
Chunosovd621bca2017-11-03 17:33:15 +0700754 "helpers_asymm.h",
755#include "./cl_kernels/helpers_asymm.hembed"
756 },
757 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100758 "histogram.cl",
759#include "./cl_kernels/histogram.clembed"
760 },
761 {
762 "hog.cl",
763#include "./cl_kernels/hog.clembed"
764 },
765 {
Gian Marco76faef82018-01-29 12:15:32 +0000766 "im2col.cl",
767#include "./cl_kernels/im2col.clembed"
768 },
769 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100770 "integral_image.cl",
771#include "./cl_kernels/integral_image.clembed"
772 },
773 {
Michalis Spyrou04f089c2017-08-08 17:42:38 +0100774 "l2_normalize.cl",
775#include "./cl_kernels/l2_normalize.clembed"
776 },
777 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100778 "magnitude_phase.cl",
779#include "./cl_kernels/magnitude_phase.clembed"
780 },
781 {
782 "mean_stddev.cl",
783#include "./cl_kernels/mean_stddev.clembed"
784 },
785 {
Giuseppe Rossinid7647d42018-07-17 18:13:13 +0100786 "memset.cl",
787#include "./cl_kernels/memset.clembed"
788 },
789 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100790 "minmaxloc.cl",
791#include "./cl_kernels/minmaxloc.clembed"
792 },
793 {
Michele Di Giorgio56dd7262017-07-27 09:53:49 +0100794 "minmax_layer.cl",
795#include "./cl_kernels/minmax_layer.clembed"
796 },
797 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100798 "non_linear_filter3x3.cl",
799#include "./cl_kernels/non_linear_filter3x3.clembed"
800 },
801 {
802 "non_linear_filter5x5.cl",
803#include "./cl_kernels/non_linear_filter5x5.clembed"
804 },
805 {
806 "non_linear_filter_helpers.h",
807#include "./cl_kernels/non_linear_filter_helpers.hembed"
808 },
809 {
810 "nonmax.cl",
811#include "./cl_kernels/nonmax.clembed"
812 },
813 {
814 "normalization_layer.cl",
815#include "./cl_kernels/normalization_layer.clembed"
816 },
817 {
Michele Di Giorgiob57be0d2018-08-31 16:26:25 +0100818 "normalize_planar_yuv_layer.cl",
819#include "./cl_kernels/normalize_planar_yuv_layer.clembed"
820 },
821 {
Michele Di Giorgiod63dfa22018-09-12 10:18:54 +0100822 "normalize_planar_yuv_layer_quantized.cl",
823#include "./cl_kernels/normalize_planar_yuv_layer_quantized.clembed"
824 },
825 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100826 "batchnormalization_layer.cl",
827#include "./cl_kernels/batchnormalization_layer.clembed"
828 },
829 {
830 "optical_flow_pyramid_lk.cl",
831#include "./cl_kernels/optical_flow_pyramid_lk.clembed"
832 },
833 {
Michalis Spyrou5237e012018-01-17 09:40:27 +0000834 "permute.cl",
835#include "./cl_kernels/permute.clembed"
836 },
837 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100838 "pixelwise_mul_float.cl",
839#include "./cl_kernels/pixelwise_mul_float.clembed"
840 },
841 {
842 "pixelwise_mul_int.cl",
843#include "./cl_kernels/pixelwise_mul_int.clembed"
844 },
845 {
846 "pooling_layer.cl",
847#include "./cl_kernels/pooling_layer.clembed"
848 },
849 {
Anton Lokhmotovaf6204c2017-11-08 09:34:19 +0000850 "pooling_layer_quantized.cl",
851#include "./cl_kernels/pooling_layer_quantized.clembed"
852 },
853 {
Michalis Spyrou6c7c38e2018-08-29 16:28:11 +0100854 "prior_box_layer.cl",
855#include "./cl_kernels/prior_box_layer.clembed"
856 },
857 {
Michele Di Giorgio56dd7262017-07-27 09:53:49 +0100858 "quantization_layer.cl",
859#include "./cl_kernels/quantization_layer.clembed"
860 },
861 {
Vidhya Sudhan Loganathan5e96be72018-12-18 14:17:00 +0000862 "range.cl",
863#include "./cl_kernels/range.clembed"
864 },
865 {
Michalis Spyrou04f089c2017-08-08 17:42:38 +0100866 "reduction_operation.cl",
867#include "./cl_kernels/reduction_operation.clembed"
868 },
869 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100870 "remap.cl",
871#include "./cl_kernels/remap.clembed"
872 },
873 {
Gian Marco Iodice477531c2018-08-21 17:53:38 +0100874 "reorg_layer.cl",
875#include "./cl_kernels/reorg_layer.clembed"
876 },
877 {
Georgios Pinitas5ee66ea2017-09-07 17:29:16 +0100878 "reshape_layer.cl",
879#include "./cl_kernels/reshape_layer.clembed"
880 },
881 {
Michele Di Giorgio5daeffd2018-11-26 10:01:15 +0000882 "reverse.cl",
883#include "./cl_kernels/reverse.clembed"
884 },
885 {
giuros0118870812018-09-13 09:31:40 +0100886 "roi_align_layer.cl",
887#include "./cl_kernels/roi_align_layer.clembed"
888 },
889 {
SiCong Li3e363692017-07-04 15:02:10 +0100890 "roi_pooling_layer.cl",
891#include "./cl_kernels/roi_pooling_layer.clembed"
892 },
893 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100894 "scale.cl",
895#include "./cl_kernels/scale.clembed"
896 },
897 {
Michalis Spyrou17220e22018-09-12 13:35:38 +0100898 "scale_quantized.cl",
899#include "./cl_kernels/scale_quantized.clembed"
900 },
901 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100902 "scharr_filter.cl",
903#include "./cl_kernels/scharr_filter.clembed"
904 },
905 {
Georgios Pinitasaaa27182018-11-21 16:32:15 +0000906 "select.cl",
907#include "./cl_kernels/select.clembed"
908 },
909 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100910 "sobel_filter.cl",
911#include "./cl_kernels/sobel_filter.clembed"
912 },
913 {
914 "softmax_layer.cl",
915#include "./cl_kernels/softmax_layer.clembed"
916 },
917 {
Chunosovf450caa2017-11-08 16:09:35 +0700918 "softmax_layer_quantized.cl",
919#include "./cl_kernels/softmax_layer_quantized.clembed"
920 },
921 {
Georgios Pinitasc1a72452018-08-24 11:25:32 +0100922 "slice_ops.cl",
923#include "./cl_kernels/slice_ops.clembed"
Georgios Pinitas77589b52018-08-21 14:41:35 +0100924 },
925 {
Michalis Spyrou16934a52018-08-21 18:03:58 +0100926 "space_to_batch.cl",
927#include "./cl_kernels/space_to_batch.clembed"
928 },
929 {
Gian Marco Iodice8aa985e2018-11-27 15:58:08 +0000930 "stack_layer.cl",
931#include "./cl_kernels/stack_layer.clembed"
932 },
933 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100934 "tablelookup.cl",
935#include "./cl_kernels/tablelookup.clembed"
936 },
937 {
938 "threshold.cl",
939#include "./cl_kernels/threshold.clembed"
940 },
941 {
giuros013175fcf2018-11-21 09:59:17 +0000942 "tile.cl",
943#include "./cl_kernels/tile.clembed"
944 },
945 {
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100946 "transpose.cl",
947#include "./cl_kernels/transpose.clembed"
948 },
949 {
950 "types.h",
951#include "./cl_kernels/types.hembed"
952 },
953 {
954 "warp_affine.cl",
955#include "./cl_kernels/warp_affine.clembed"
956 },
957 {
958 "warp_helpers.h",
959#include "./cl_kernels/warp_helpers.hembed"
960 },
961 {
962 "warp_perspective.cl",
963#include "./cl_kernels/warp_perspective.clembed"
Michalis Spyroud7e82812017-06-20 15:00:14 +0100964 },
Giorgio Arena1f9ca1d2018-03-01 11:13:45 +0000965 {
Giorgio Arenaa50e5e02018-07-02 13:42:23 +0100966 "winograd_filter_transform.cl",
967#include "./cl_kernels/winograd_filter_transform.clembed"
968 },
969 {
970 "winograd_input_transform.cl",
971#include "./cl_kernels/winograd_input_transform.clembed"
972 },
973 {
974 "winograd_output_transform.cl",
975#include "./cl_kernels/winograd_output_transform.clembed"
Giorgio Arena1f9ca1d2018-03-01 11:13:45 +0000976 },
Giorgio Arena73023022018-09-04 14:55:55 +0100977 {
978 "yolo_layer.cl",
979#include "./cl_kernels/yolo_layer.clembed"
980 },
Anthony Barbierac69aa12017-07-03 17:39:37 +0100981#endif /* EMBEDDED_KERNELS */
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100982};
983
984CLKernelLibrary::CLKernelLibrary()
Abel Bernabeu5a6e0532017-09-28 09:53:45 +0100985 : _context(), _device(), _kernel_path("."), _programs_map(), _built_programs_map()
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100986{
Anthony Barbierecb1c622018-04-17 11:45:10 +0100987 opencl_is_available(); // Make sure the OpenCL symbols are initialised *before* the CLKernelLibrary is built
Anthony Barbier6ff3b192017-09-04 18:44:23 +0100988}
989
990CLKernelLibrary &CLKernelLibrary::get()
991{
992 static CLKernelLibrary _kernel_library;
993 return _kernel_library;
994}
995
996Kernel CLKernelLibrary::create_kernel(const std::string &kernel_name, const StringSet &build_options_set) const
997{
998 // Find which program contains the kernel
999 auto kernel_program_it = _kernel_program_map.find(kernel_name);
1000
1001 if(_kernel_program_map.end() == kernel_program_it)
1002 {
1003 ARM_COMPUTE_ERROR("Kernel %s not found in the CLKernelLibrary", kernel_name.c_str());
1004 }
steniu0134702472017-07-11 09:22:58 +01001005 std::string concat_str;
1006
Georgios Pinitasdf473ea2018-05-31 18:53:52 +01001007#if defined(ARM_COMPUTE_DEBUG_ENABLED)
1008 // Enable debug properties in CL kernels
1009 concat_str += " -DARM_COMPUTE_DEBUG_ENABLED";
1010#endif // defined(ARM_COMPUTE_DEBUG_ENABLED)
1011
Vidhya Sudhan Loganathanf1f49062018-05-25 13:21:26 +01001012 if(fp16_supported())
Matthew Bentham6f31f8c2017-10-27 11:50:06 +01001013 {
1014 concat_str += " -DARM_COMPUTE_OPENCL_FP16_ENABLED=1 ";
1015 }
1016
Michalis Spyroue03342e2018-01-15 14:39:13 +00001017 if(dot8_supported(_device))
1018 {
1019 concat_str += " -DARM_COMPUTE_OPENCL_DOT8_ENABLED=1 ";
1020 }
1021
Giorgio Arenaeff8d952018-07-02 15:29:57 +01001022 if(dot8_acc_supported(_device))
1023 {
1024 concat_str += " -DARM_COMPUTE_OPENCL_DOT8_ACC_ENABLED=1 ";
1025 }
1026
Pablo Telloe86a09f2018-01-11 15:44:48 +00001027 if(get_cl_version(_device) == CLVersion::CL20)
steniu0134702472017-07-11 09:22:58 +01001028 {
1029 concat_str += " -cl-std=CL2.0 ";
1030 }
Anthony Barbierd727e852018-04-20 11:05:29 +01001031 else if(arm_non_uniform_workgroup_supported(_device))
Pablo Telloe86a09f2018-01-11 15:44:48 +00001032 {
1033 concat_str += " -cl-arm-non-uniform-work-group-size ";
1034 }
steniu0134702472017-07-11 09:22:58 +01001035 else
1036 {
1037 ARM_COMPUTE_ERROR("Non uniform workgroup size is not supported!!");
1038 }
1039
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001040 // Check if the program has been built before with same build options.
steniu0134702472017-07-11 09:22:58 +01001041 const std::string program_name = kernel_program_it->second;
1042 const std::string build_options = stringify_set(build_options_set) + concat_str;
1043
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001044 const std::string built_program_name = program_name + "_" + build_options;
1045 auto built_program_it = _built_programs_map.find(built_program_name);
1046
1047 cl::Program cl_program;
1048
1049 if(_built_programs_map.end() != built_program_it)
1050 {
1051 // If program has been built, retrieve to create kernel from it
1052 cl_program = built_program_it->second;
1053 }
1054 else
1055 {
1056 // Get program
1057 Program program = load_program(program_name);
1058
1059 // Build program
1060 cl_program = program.build(build_options);
1061
1062 // Add built program to internal map
1063 _built_programs_map.emplace(built_program_name, cl_program);
1064 }
1065
1066 // Create and return kernel
1067 return Kernel(kernel_name, cl_program);
1068}
1069
Anthony Barbier7da55aa2018-04-13 16:58:43 +01001070void CLKernelLibrary::add_built_program(const std::string &built_program_name, cl::Program program)
1071{
1072 _built_programs_map.emplace(built_program_name, program);
1073}
1074
Vidhya Sudhan Loganathanf1f49062018-05-25 13:21:26 +01001075bool CLKernelLibrary::fp16_supported() const
1076{
1077 return ::fp16_supported(_device);
1078}
1079
Vidhya Sudhan Loganathan76c85642018-05-25 13:53:02 +01001080bool CLKernelLibrary::int64_base_atomics_supported() const
1081{
1082 return device_supports_extension(_device, "cl_khr_int64_base_atomics");
1083}
1084
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001085const Program &CLKernelLibrary::load_program(const std::string &program_name) const
1086{
1087 const auto program_it = _programs_map.find(program_name);
1088
1089 if(program_it != _programs_map.end())
1090 {
1091 return program_it->second;
1092 }
1093
1094 Program program;
1095
1096#ifdef EMBEDDED_KERNELS
1097 const auto program_source_it = _program_source_map.find(program_name);
1098
1099 if(_program_source_map.end() == program_source_it)
1100 {
1101 ARM_COMPUTE_ERROR("Embedded program for %s does not exist.", program_name.c_str());
1102 }
1103
1104 program = Program(_context, program_name, program_source_it->second);
Anthony Barbierac69aa12017-07-03 17:39:37 +01001105#else /* EMBEDDED_KERNELS */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001106 // Check for binary
1107 std::string source_name = _kernel_path + program_name;
1108 std::string binary_name = source_name + "bin";
1109
1110 if(std::ifstream(binary_name).is_open())
1111 {
1112 const std::string program_binary = read_file(binary_name, true);
1113 program = Program(_context, _device, program_name, std::vector<unsigned char>(program_binary.begin(), program_binary.end()));
1114 }
1115 else if(std::ifstream(source_name).is_open())
1116 {
1117 program = Program(_context, program_name, read_file(source_name, false));
1118 }
1119 else
1120 {
1121 ARM_COMPUTE_ERROR("Kernel file %s does not exist.", source_name.c_str());
1122 }
Anthony Barbierac69aa12017-07-03 17:39:37 +01001123#endif /* EMBEDDED_KERNELS */
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001124
1125 // Insert program to program map
1126 const auto new_program = _programs_map.emplace(program_name, std::move(program));
1127
1128 return new_program.first->second;
1129}
1130
1131std::string CLKernelLibrary::stringify_set(const StringSet &s) const
1132{
steniu0134702472017-07-11 09:22:58 +01001133 std::string concat_set;
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001134
1135#ifndef EMBEDDED_KERNELS
1136 concat_set += "-I" + _kernel_path + " ";
1137#endif /* EMBEDDED_KERNELS */
1138
1139 // Concatenate set
1140 for(const auto &el : s)
1141 {
1142 concat_set += " " + el;
1143 }
1144
1145 return concat_set;
1146}
Michalis Spyroud7e82812017-06-20 15:00:14 +01001147
1148std::string CLKernelLibrary::get_program_source(const std::string &program_name)
1149{
1150 const auto program_source_it = _program_source_map.find(program_name);
1151
1152 if(program_source_it == _program_source_map.end())
1153 {
1154 ARM_COMPUTE_ERROR("Embedded program for %s does not exist.", program_name.c_str());
1155 }
1156
1157 return program_source_it->second;
1158}
steniu015f910722017-08-23 10:15:22 +01001159
Abel Bernabeu5a6e0532017-09-28 09:53:45 +01001160size_t CLKernelLibrary::max_local_workgroup_size(const cl::Kernel &kernel) const
steniu015f910722017-08-23 10:15:22 +01001161{
Abel Bernabeu5a6e0532017-09-28 09:53:45 +01001162 size_t result;
steniu015f910722017-08-23 10:15:22 +01001163
Abel Bernabeu5a6e0532017-09-28 09:53:45 +01001164 size_t err = kernel.getWorkGroupInfo(_device, CL_KERNEL_WORK_GROUP_SIZE, &result);
1165 ARM_COMPUTE_ERROR_ON_MSG(err != 0, "clGetKernelWorkGroupInfo failed to return the maximum workgroup size for the kernel");
1166 ARM_COMPUTE_UNUSED(err);
1167
1168 return result;
steniu015f910722017-08-23 10:15:22 +01001169}
1170
Abel Bernabeu5a6e0532017-09-28 09:53:45 +01001171cl::NDRange CLKernelLibrary::default_ndrange() const
steniu015f910722017-08-23 10:15:22 +01001172{
Anthony Barbierb6eb3532018-08-08 13:20:04 +01001173 GPUTarget _target = get_target_from_device(_device);
Michalis Spyroua9676112018-02-22 18:07:43 +00001174 cl::NDRange default_range;
1175
1176 switch(_target)
1177 {
1178 case GPUTarget::MIDGARD:
1179 case GPUTarget::T600:
1180 case GPUTarget::T700:
1181 case GPUTarget::T800:
1182 default_range = cl::NDRange(128u, 1);
1183 break;
1184 default:
1185 default_range = cl::NullRange;
1186 }
1187
1188 return default_range;
steniu015f910722017-08-23 10:15:22 +01001189}
Anthony Barbier847864d2018-03-07 11:35:53 +00001190
1191std::string CLKernelLibrary::get_device_version()
1192{
1193 return _device.getInfo<CL_DEVICE_VERSION>();
1194}