Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1 | /* |
Michalis Spyrou | 5237e01 | 2018-01-17 09:40:27 +0000 | [diff] [blame] | 2 | * Copyright (c) 2016-2018 ARM Limited. |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 3 | * |
| 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 | |
steniu01 | 3470247 | 2017-07-11 09:22:58 +0100 | [diff] [blame] | 26 | #include "arm_compute/core/CL/CLHelpers.h" |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 27 | #include "arm_compute/core/Error.h" |
| 28 | #include "arm_compute/core/Utils.h" |
| 29 | |
steniu01 | 5f91072 | 2017-08-23 10:15:22 +0100 | [diff] [blame] | 30 | #include <algorithm> |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 31 | #include <fstream> |
| 32 | #include <iostream> |
| 33 | #include <utility> |
| 34 | #include <vector> |
| 35 | |
| 36 | using namespace arm_compute; |
| 37 | |
Georgios Pinitas | 388d3ec | 2017-11-02 12:17:56 +0000 | [diff] [blame] | 38 | CLBuildOptions::CLBuildOptions() |
| 39 | : _build_opts() |
| 40 | { |
| 41 | } |
| 42 | |
| 43 | void CLBuildOptions::add_option(std::string option) |
| 44 | { |
| 45 | _build_opts.emplace(std::move(option)); |
| 46 | } |
| 47 | |
| 48 | void CLBuildOptions::add_option_if(bool cond, std::string option) |
| 49 | { |
| 50 | if(cond) |
| 51 | { |
| 52 | add_option(std::move(option)); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | void 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 | |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 61 | void CLBuildOptions::add_options(const StringSet &options) |
| 62 | { |
| 63 | _build_opts.insert(options.begin(), options.end()); |
| 64 | } |
| 65 | |
| 66 | void CLBuildOptions::add_options_if(bool cond, const StringSet &options) |
| 67 | { |
| 68 | if(cond) |
| 69 | { |
| 70 | add_options(options); |
| 71 | } |
| 72 | } |
| 73 | |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 74 | const CLBuildOptions::StringSet &CLBuildOptions::options() const |
Georgios Pinitas | 388d3ec | 2017-11-02 12:17:56 +0000 | [diff] [blame] | 75 | { |
| 76 | return _build_opts; |
| 77 | } |
| 78 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 79 | Program::Program() |
| 80 | : _context(), _device(), _is_binary(false), _name(), _source(), _binary() |
| 81 | { |
| 82 | } |
| 83 | |
| 84 | Program::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 | |
| 89 | Program::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 | |
| 94 | Program::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 | |
| 106 | bool 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 | |
| 126 | cl::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 | |
| 133 | Kernel::Kernel() |
| 134 | : _name(), _kernel() |
| 135 | { |
| 136 | } |
| 137 | |
| 138 | Kernel::Kernel(std::string name, const cl::Program &program) |
| 139 | : _name(std::move(name)), |
| 140 | _kernel(cl::Kernel(program, _name.c_str())) |
| 141 | { |
| 142 | } |
| 143 | |
| 144 | const 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 Iwaniec | 0063380 | 2017-10-12 14:14:15 +0100 | [diff] [blame] | 151 | { "activation_layer_qa8", "activation_layer_qa8.cl" }, |
Michele Di Giorgio | 4622ac1 | 2018-06-27 16:41:17 +0100 | [diff] [blame] | 152 | { "arithmetic_add_quantized", "arithmetic_op_quantized.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 153 | { "arithmetic_add", "arithmetic_op.cl" }, |
| 154 | { "arithmetic_sub", "arithmetic_op.cl" }, |
Georgios Pinitas | cbf39c6 | 2018-09-10 15:07:45 +0100 | [diff] [blame] | 155 | { "arithmetic_sub_quantized", "arithmetic_op_quantized.cl" }, |
Michalis Spyrou | 0a88792 | 2018-06-11 16:30:23 +0100 | [diff] [blame] | 156 | { "arithmetic_div", "arithmetic_op.cl" }, |
Michalis Spyrou | f1addb6 | 2018-09-11 11:16:47 +0100 | [diff] [blame] | 157 | { "batch_to_space_nchw", "batch_to_space.cl" }, |
| 158 | { "batch_to_space_static_nchw", "batch_to_space.cl" }, |
| 159 | { "batch_to_space_nhwc", "batch_to_space.cl" }, |
| 160 | { "batch_to_space_static_nhwc", "batch_to_space.cl" }, |
Michele Di Giorgio | bf3c662 | 2018-03-08 11:52:27 +0000 | [diff] [blame] | 161 | { "batchnormalization_layer_nchw", "batchnormalization_layer.cl" }, |
| 162 | { "batchnormalization_layer_nhwc", "batchnormalization_layer.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 163 | { "bitwise_or", "bitwise_op.cl" }, |
| 164 | { "bitwise_and", "bitwise_op.cl" }, |
| 165 | { "bitwise_xor", "bitwise_op.cl" }, |
| 166 | { "bitwise_not", "bitwise_op.cl" }, |
giuros01 | c04a0e8 | 2018-10-03 12:44:35 +0100 | [diff] [blame] | 167 | { "bounding_box_transform", "bounding_box_transform.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 168 | { "channel_combine_NV", "channel_combine.cl" }, |
| 169 | { "channel_combine_RGB888", "channel_combine.cl" }, |
| 170 | { "channel_combine_RGBA8888", "channel_combine.cl" }, |
| 171 | { "channel_combine_UYVY422", "channel_combine.cl" }, |
| 172 | { "channel_combine_YUYV422", "channel_combine.cl" }, |
Michele Di Giorgio | 7217563 | 2018-05-01 16:52:00 +0100 | [diff] [blame] | 173 | { "channel_shuffle_nchw", "channel_shuffle.cl" }, |
Gian Marco Iodice | 8bab0ee | 2018-09-13 11:51:56 +0100 | [diff] [blame] | 174 | { "channel_shuffle_nhwc", "channel_shuffle.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 175 | { "channel_extract_NV12", "channel_extract.cl" }, |
| 176 | { "channel_extract_NV21", "channel_extract.cl" }, |
| 177 | { "channel_extract_RGB888", "channel_extract.cl" }, |
| 178 | { "channel_extract_RGBA8888", "channel_extract.cl" }, |
| 179 | { "channel_extract_UYVY422", "channel_extract.cl" }, |
| 180 | { "channel_extract_YUYV422", "channel_extract.cl" }, |
| 181 | { "combine_gradients_L1", "canny.cl" }, |
| 182 | { "combine_gradients_L2", "canny.cl" }, |
| 183 | { "concatenate_depth", "concatenate.cl" }, |
Michalis Spyrou | 55b3d12 | 2018-05-09 09:59:23 +0100 | [diff] [blame] | 184 | { "concatenate_width", "concatenate.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 185 | { "convolution_rectangle", "convolution_rectangle.cl" }, |
Gian Marco | 76faef8 | 2018-01-29 12:15:32 +0000 | [diff] [blame] | 186 | { "col2im", "col2im.cl" }, |
Giorgio Arena | 657bdb3 | 2018-04-26 18:52:01 +0100 | [diff] [blame] | 187 | { "convert_depth_down", "depth_convert.cl" }, |
| 188 | { "convert_depth_up", "depth_convert.cl" }, |
| 189 | { "convert_fc_weights", "convert_fc_weights.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 190 | { "convolution3x3_static", "convolution3x3.cl" }, |
| 191 | { "convolution5x5_static", "convolution5x5.cl" }, |
| 192 | { "convolution7x7_static", "convolution7x7.cl" }, |
| 193 | { "convolution9x9_static", "convolution9x9.cl" }, |
| 194 | { "convolution_separable1x5_static", "convolution5x5.cl" }, |
| 195 | { "convolution_separable5x1_static", "convolution5x5.cl" }, |
| 196 | { "convolution_separable1x7_static", "convolution7x7.cl" }, |
| 197 | { "convolution_separable7x1_static", "convolution7x7.cl" }, |
| 198 | { "convolution_separable1x9_static", "convolution9x9.cl" }, |
| 199 | { "convolution_separable9x1_static", "convolution9x9.cl" }, |
Michalis Spyrou | 5c8e05c | 2018-03-22 11:56:01 +0000 | [diff] [blame] | 200 | { "copy_tensor", "copy_tensor.cl" }, |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 201 | { "copy_pad_tensor", "copy_tensor.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 202 | { "copy_plane", "channel_extract.cl" }, |
| 203 | { "copy_planes_3p", "channel_combine.cl" }, |
| 204 | { "copy_to_keypoint", "fast_corners.cl" }, |
Michalis Spyrou | 780db4e | 2017-11-23 09:49:51 +0000 | [diff] [blame] | 205 | { "deconvolution_upsample", "deconvolution_layer.cl" }, |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 206 | { "depthwise_convolution_3x3", "depthwise_convolution.cl" }, |
Michele Di Giorgio | 933fe86 | 2018-02-19 15:42:12 +0000 | [diff] [blame] | 207 | { "depthwise_convolution_3x3_f16", "depthwise_convolution.cl" }, |
Giorgio Arena | d051e97 | 2018-06-20 11:46:42 +0100 | [diff] [blame] | 208 | { "depthwise_convolution_3x3_nhwc", "depthwise_convolution.cl" }, |
| 209 | { "depthwise_convolution_3x3_nhwc_stride1", "depthwise_convolution.cl" }, |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 210 | { "depthwise_convolution_3x3_quantized_nchw", "depthwise_convolution_quantized.cl" }, |
Giorgio Arena | eff8d95 | 2018-07-02 15:29:57 +0100 | [diff] [blame] | 211 | { "depthwise_convolution_3x3_quantized_nhwc", "depthwise_convolution_quantized.cl" }, |
Giorgio Arena | dfca60b | 2018-01-31 10:30:59 +0000 | [diff] [blame] | 212 | { "depthwise_convolution_3x3_quantized_nhwc_stride1", "depthwise_convolution_quantized.cl" }, |
Giorgio Arena | eff8d95 | 2018-07-02 15:29:57 +0100 | [diff] [blame] | 213 | { "depthwise_convolution_3x3_quantized_dot8_nchw", "depthwise_convolution_quantized.cl" }, |
| 214 | { "depthwise_convolution_3x3_quantized_dot8_nhwc_stride1", "depthwise_convolution_quantized.cl" }, |
Michele Di Giorgio | 3ebef32 | 2018-02-21 10:02:58 +0000 | [diff] [blame] | 215 | { "depthwise_convolution_3x3_stridex1_stridey1_bifrost_f16", "depthwise_convolution.cl" }, |
| 216 | { "depthwise_convolution_3x3_stridex2_stridey2_bifrost_f16", "depthwise_convolution.cl" }, |
| 217 | { "depthwise_convolution_3x3_stridex1_stridey1_bifrost_f32", "depthwise_convolution.cl" }, |
| 218 | { "depthwise_convolution_3x3_stridex2_stridey2_bifrost_f32", "depthwise_convolution.cl" }, |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 219 | { "depthwise_im2col", "depthwise_convolution.cl" }, |
| 220 | { "depthwise_vector_to_tensor", "depthwise_convolution.cl" }, |
| 221 | { "depthwise_weights_reshape", "depthwise_convolution.cl" }, |
Michele Di Giorgio | 56dd726 | 2017-07-27 09:53:49 +0100 | [diff] [blame] | 222 | { "dequantization_layer", "dequantization_layer.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 223 | { "derivative", "derivative.cl" }, |
| 224 | { "dilate", "dilate.cl" }, |
SiCong Li | c51b72f | 2017-07-28 14:46:20 +0100 | [diff] [blame] | 225 | { "direct_convolution1x1", "direct_convolution1x1.cl" }, |
Pablo Tello | 3d31946 | 2018-06-21 15:13:17 +0100 | [diff] [blame] | 226 | { "direct_convolution1x1_nhwc", "direct_convolution1x1.cl" }, |
Gian Marco Iodice | 1c8409d | 2017-09-06 17:24:25 +0100 | [diff] [blame] | 227 | { "direct_convolution1x1_f32_bifrost", "direct_convolution1x1.cl" }, |
SiCong Li | c51b72f | 2017-07-28 14:46:20 +0100 | [diff] [blame] | 228 | { "direct_convolution3x3", "direct_convolution3x3.cl" }, |
Pablo Tello | 3d31946 | 2018-06-21 15:13:17 +0100 | [diff] [blame] | 229 | { "direct_convolution3x3_nhwc", "direct_convolution3x3.cl" }, |
Gian Marco Iodice | 1246b63 | 2017-08-16 18:38:32 +0100 | [diff] [blame] | 230 | { "direct_convolution3x3_f32_bifrost", "direct_convolution3x3.cl" }, |
steniu01 | db00668 | 2017-08-09 16:26:22 +0100 | [diff] [blame] | 231 | { "direct_convolution5x5", "direct_convolution5x5.cl" }, |
Pablo Tello | 3d31946 | 2018-06-21 15:13:17 +0100 | [diff] [blame] | 232 | { "direct_convolution5x5_nhwc", "direct_convolution5x5.cl" }, |
Gian Marco Iodice | 1246b63 | 2017-08-16 18:38:32 +0100 | [diff] [blame] | 233 | { "direct_convolution5x5_f32_bifrost", "direct_convolution5x5.cl" }, |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 234 | { "direct_convolution_1x1_3x3_5x5_quantized", "direct_convolution_1x1_3x3_5x5_quantized.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 235 | { "erode", "erode.cl" }, |
| 236 | { "fast_corners", "fast_corners.cl" }, |
Gian Marco Iodice | 215b4ea | 2018-06-28 16:29:29 +0100 | [diff] [blame] | 237 | { "flatten", "flatten.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 238 | { "fill_image_borders_constant", "fill_border.cl" }, |
| 239 | { "fill_image_borders_replicate", "fill_border.cl" }, |
| 240 | { "finalize", "optical_flow_pyramid_lk.cl" }, |
Georgios Pinitas | c936917 | 2018-09-26 11:25:40 +0100 | [diff] [blame] | 241 | { "fuse_batchnormalization_layer", "batchnormalization_layer.cl" }, |
Georgios Pinitas | d8e765b | 2017-08-02 13:44:33 +0100 | [diff] [blame] | 242 | { "floor_layer", "floor.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 243 | { "gaussian1x5_sub_x", "gaussian_pyramid.cl" }, |
| 244 | { "gaussian5x1_sub_y", "gaussian_pyramid.cl" }, |
Gian Marco Iodice | 578ab61 | 2017-06-23 09:34:33 +0100 | [diff] [blame] | 245 | { "gemm_accumulate_biases", "gemm.cl" }, |
Gian Marco | 36a0a46 | 2018-01-12 10:21:40 +0000 | [diff] [blame] | 246 | { "gemm_interleave4x4", "gemm.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 247 | { "gemm_ma_f16", "gemm.cl" }, |
| 248 | { "gemm_ma_f32", "gemm.cl" }, |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 249 | { "gemm_mv", "gemv.cl" }, |
Georgios Pinitas | de5a1cc | 2018-02-02 12:52:07 +0000 | [diff] [blame] | 250 | { "gemm_mv_quantized", "gemv.cl" }, |
Gian Marco Iodice | edfa9f4 | 2017-08-15 11:45:22 +0100 | [diff] [blame] | 251 | { "gemm_mm_interleaved_transposed_f16", "gemm.cl" }, |
Gian Marco Iodice | bb36a8e | 2018-04-19 12:05:08 +0100 | [diff] [blame] | 252 | { "gemm_mm_interleaved_transposed_f16_bifrost", "gemm.cl" }, |
| 253 | { "gemm_mm_interleaved_transposed_f32", "gemm.cl" }, |
Gian Marco Iodice | edfa9f4 | 2017-08-15 11:45:22 +0100 | [diff] [blame] | 254 | { "gemm_mm_interleaved_transposed_f32_bifrost", "gemm.cl" }, |
Gian Marco Iodice | edfa9f4 | 2017-08-15 11:45:22 +0100 | [diff] [blame] | 255 | { "gemm_mm_floating_point", "gemm.cl" }, |
Gian Marco Iodice | fd68311 | 2018-04-17 09:52:44 +0100 | [diff] [blame] | 256 | { "gemm_mm_floating_point_f16_bifrost", "gemm.cl" }, |
Anton Lokhmotov | 3e80c7f | 2017-11-20 11:02:10 +0000 | [diff] [blame] | 257 | { "gemm_mm_floating_point_f32_bifrost", "gemm.cl" }, |
| 258 | { "gemm_mm_floating_point_f32_bifrost_1000", "gemm.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 259 | { "gemm_lc_vm_f32", "gemm.cl" }, |
Gian Marco | 36a0a46 | 2018-01-12 10:21:40 +0000 | [diff] [blame] | 260 | { "gemm_transpose1xW", "gemm.cl" }, |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 261 | { "gemmlowp_matrix_a_reduction", "gemmlowp.cl" }, |
Gian Marco Iodice | 4b90865 | 2018-10-18 10:21:02 +0100 | [diff] [blame] | 262 | { "gemmlowp_matrix_a_reduction_dot8", "gemmlowp.cl" }, |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 263 | { "gemmlowp_matrix_b_reduction", "gemmlowp.cl" }, |
Gian Marco | 7b4d547 | 2018-01-10 15:56:30 +0000 | [diff] [blame] | 264 | { "gemmlowp_mm_bifrost", "gemmlowp.cl" }, |
Giorgio Arena | 6200fa4 | 2018-07-06 17:06:36 +0100 | [diff] [blame] | 265 | { "gemmlowp_mm_bifrost_dot8", "gemmlowp.cl" }, |
Gian Marco | 7b4d547 | 2018-01-10 15:56:30 +0000 | [diff] [blame] | 266 | { "gemmlowp_mm_midgard", "gemmlowp.cl" }, |
Gian Marco | 19835e5 | 2018-01-30 13:35:54 +0000 | [diff] [blame] | 267 | { "gemmlowp_mm_interleaved_transposed_bifrost", "gemmlowp.cl" }, |
Giorgio Arena | 6200fa4 | 2018-07-06 17:06:36 +0100 | [diff] [blame] | 268 | { "gemmlowp_mm_interleaved_transposed_bifrost_dot8", "gemmlowp.cl" }, |
Gian Marco | 19835e5 | 2018-01-30 13:35:54 +0000 | [diff] [blame] | 269 | { "gemmlowp_mm_interleaved_transposed_midgard", "gemmlowp.cl" }, |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 270 | { "gemmlowp_offset_contribution", "gemmlowp.cl" }, |
Gian Marco Iodice | 4b90865 | 2018-10-18 10:21:02 +0100 | [diff] [blame] | 271 | { "gemmlowp_offset_contribution_quantize_down", "gemmlowp.cl" }, |
| 272 | { "gemmlowp_offset_contribution_quantize_down_fixedpoint", "gemmlowp.cl" }, |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 273 | { "gemmlowp_output_stage_quantize_down", "gemmlowp.cl" }, |
Gian Marco | 58c5794 | 2017-11-28 09:10:03 +0000 | [diff] [blame] | 274 | { "gemmlowp_output_stage_quantize_down_fixedpoint", "gemmlowp.cl" }, |
Georgios Pinitas | 51e53a3 | 2018-10-22 13:49:08 +0100 | [diff] [blame] | 275 | { "gemmlowp_output_stage_quantize_down_float", "gemmlowp.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 276 | { "harris_score_3x3", "harris_corners.cl" }, |
| 277 | { "harris_score_5x5", "harris_corners.cl" }, |
| 278 | { "harris_score_7x7", "harris_corners.cl" }, |
| 279 | { "hist_border_kernel", "histogram.cl" }, |
| 280 | { "hist_border_kernel_fixed", "histogram.cl" }, |
| 281 | { "hist_local_kernel", "histogram.cl" }, |
| 282 | { "hist_local_kernel_fixed", "histogram.cl" }, |
| 283 | { "hog_block_normalization", "hog.cl" }, |
| 284 | { "hog_detector", "hog.cl" }, |
| 285 | { "hog_orientation_binning", "hog.cl" }, |
| 286 | { "hysteresis", "canny.cl" }, |
Gian Marco Iodice | 215b4ea | 2018-06-28 16:29:29 +0100 | [diff] [blame] | 287 | { "im2col1x1_stridex1_nchw", "im2col.cl" }, |
| 288 | { "im2col3x3_nchw", "im2col.cl" }, |
| 289 | { "im2col5x5_nchw", "im2col.cl" }, |
| 290 | { "im2col11x11_padx0_pady0_nchw", "im2col.cl" }, |
| 291 | { "im2col_generic_nchw", "im2col.cl" }, |
| 292 | { "im2col_generic_padx0_pady0_nchw", "im2col.cl" }, |
Pablo Tello | 4a626a7 | 2018-04-04 10:01:14 +0100 | [diff] [blame] | 293 | { "im2col3x3_nhwc", "im2col.cl" }, |
| 294 | { "im2col_generic_nhwc", "im2col.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 295 | { "init_level", "optical_flow_pyramid_lk.cl" }, |
| 296 | { "init_level_max", "optical_flow_pyramid_lk.cl" }, |
| 297 | { "init_level_max_initial_estimate", "optical_flow_pyramid_lk.cl" }, |
| 298 | { "integral_horizontal", "integral_image.cl" }, |
| 299 | { "integral_vertical", "integral_image.cl" }, |
| 300 | { "IYUV_to_NV12_bt709", "color_convert.cl" }, |
| 301 | { "IYUV_to_RGB888_bt709", "color_convert.cl" }, |
| 302 | { "IYUV_to_RGBA8888_bt709", "color_convert.cl" }, |
| 303 | { "IYUV_to_YUV444_bt709", "color_convert.cl" }, |
Michalis Spyrou | 8aaf93e | 2018-10-11 17:33:32 +0100 | [diff] [blame] | 304 | { "l2_normalize_nchw", "l2_normalize.cl" }, |
| 305 | { "l2_normalize_nhwc", "l2_normalize.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 306 | { "lktracker_stage0", "optical_flow_pyramid_lk.cl" }, |
| 307 | { "lktracker_stage1", "optical_flow_pyramid_lk.cl" }, |
| 308 | { "magnitude_phase", "magnitude_phase.cl" }, |
| 309 | { "mean_stddev_accumulate", "mean_stddev.cl" }, |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 310 | { "memset", "memset.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 311 | { "minmax", "minmaxloc.cl" }, |
| 312 | { "minmax_border", "minmaxloc.cl" }, |
Michele Di Giorgio | 56dd726 | 2017-07-27 09:53:49 +0100 | [diff] [blame] | 313 | { "minmax_layer", "minmax_layer.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 314 | { "minmaxloc", "minmaxloc.cl" }, |
| 315 | { "non_linear_filter_box3x3", "non_linear_filter3x3.cl" }, |
| 316 | { "non_linear_filter_cross3x3", "non_linear_filter3x3.cl" }, |
| 317 | { "non_linear_filter_disk3x3", "non_linear_filter3x3.cl" }, |
| 318 | { "non_linear_filter_box5x5", "non_linear_filter5x5.cl" }, |
| 319 | { "non_linear_filter_cross5x5", "non_linear_filter5x5.cl" }, |
| 320 | { "non_linear_filter_disk5x5", "non_linear_filter5x5.cl" }, |
| 321 | { "non_max_suppression", "nonmax.cl" }, |
| 322 | { "normalization_layer_cross_map", "normalization_layer.cl" }, |
Georgios Pinitas | 0162436 | 2017-11-30 10:53:31 +0000 | [diff] [blame] | 323 | { "normalization_layer_in_map", "normalization_layer.cl" }, |
Michele Di Giorgio | b57be0d | 2018-08-31 16:26:25 +0100 | [diff] [blame] | 324 | { "normalize_planar_yuv_layer_nchw", "normalize_planar_yuv_layer.cl" }, |
| 325 | { "normalize_planar_yuv_layer_nhwc", "normalize_planar_yuv_layer.cl" }, |
Michele Di Giorgio | d63dfa2 | 2018-09-12 10:18:54 +0100 | [diff] [blame] | 326 | { "normalize_planar_yuv_layer_q8_nchw", "normalize_planar_yuv_layer_quantized.cl" }, |
| 327 | { "normalize_planar_yuv_layer_q8_nhwc", "normalize_planar_yuv_layer_quantized.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 328 | { "NV12_to_IYUV_bt709", "color_convert.cl" }, |
| 329 | { "NV12_to_RGB888_bt709", "color_convert.cl" }, |
| 330 | { "NV12_to_RGBA8888_bt709", "color_convert.cl" }, |
| 331 | { "NV12_to_YUV444_bt709", "color_convert.cl" }, |
| 332 | { "NV21_to_IYUV_bt709", "color_convert.cl" }, |
| 333 | { "NV21_to_RGB888_bt709", "color_convert.cl" }, |
| 334 | { "NV21_to_RGBA8888_bt709", "color_convert.cl" }, |
| 335 | { "NV21_to_YUV444_bt709", "color_convert.cl" }, |
Giorgio Arena | a086a0a | 2018-02-16 12:42:16 +0000 | [diff] [blame] | 336 | { "output_stage_quantized", "direct_convolution_1x1_3x3_5x5_quantized.cl" }, |
Michalis Spyrou | 5237e01 | 2018-01-17 09:40:27 +0000 | [diff] [blame] | 337 | { "permute_201", "permute.cl" }, |
| 338 | { "permute_120", "permute.cl" }, |
| 339 | { "permute_3201", "permute.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 340 | { "pixelwise_mul_float", "pixelwise_mul_float.cl" }, |
| 341 | { "pixelwise_mul_int", "pixelwise_mul_int.cl" }, |
Georgios Pinitas | bf28a3c | 2018-09-18 14:34:48 +0100 | [diff] [blame] | 342 | { "pixelwise_mul_quantized", "pixelwise_mul_int.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 343 | { "pooling_layer_2", "pooling_layer.cl" }, |
| 344 | { "pooling_layer_3", "pooling_layer.cl" }, |
Anton Lokhmotov | af6204c | 2017-11-08 09:34:19 +0000 | [diff] [blame] | 345 | { "pooling_layer_optimized_3", "pooling_layer.cl" }, |
Georgios Pinitas | ce09314 | 2017-06-19 16:11:53 +0100 | [diff] [blame] | 346 | { "pooling_layer_7", "pooling_layer.cl" }, |
Michalis Spyrou | e74b201 | 2018-04-18 09:49:16 +0100 | [diff] [blame] | 347 | { "pooling_layer_MxN_nchw", "pooling_layer.cl" }, |
| 348 | { "pooling_layer_MxN_nhwc", "pooling_layer.cl" }, |
| 349 | { "pooling_layer_MxN_quantized_nhwc", "pooling_layer_quantized.cl" }, |
| 350 | { "pooling_layer_MxN_quantized_nchw", "pooling_layer_quantized.cl" }, |
Michele Di Giorgio | 56dd726 | 2017-07-27 09:53:49 +0100 | [diff] [blame] | 351 | { "quantization_layer", "quantization_layer.cl" }, |
Michalis Spyrou | 7e9391b | 2018-10-05 14:49:28 +0100 | [diff] [blame] | 352 | { "reduction_operation_x", "reduction_operation.cl" }, |
| 353 | { "reduction_operation_quantized_x", "reduction_operation.cl" }, |
| 354 | { "reduction_operation_y", "reduction_operation.cl" }, |
| 355 | { "reduction_operation_z", "reduction_operation.cl" }, |
| 356 | { "reduction_operation_w", "reduction_operation.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 357 | { "remap_nearest_neighbour", "remap.cl" }, |
| 358 | { "remap_bilinear", "remap.cl" }, |
Gian Marco Iodice | 477531c | 2018-08-21 17:53:38 +0100 | [diff] [blame] | 359 | { "reorg_layer_nchw", "reorg_layer.cl" }, |
| 360 | { "reorg_layer_nhwc", "reorg_layer.cl" }, |
Georgios Pinitas | 5ee66ea | 2017-09-07 17:29:16 +0100 | [diff] [blame] | 361 | { "reshape_layer", "reshape_layer.cl" }, |
Gian Marco Iodice | 215b4ea | 2018-06-28 16:29:29 +0100 | [diff] [blame] | 362 | { "reshape_to_columns", "convolution_layer.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 363 | { "RGB888_to_IYUV_bt709", "color_convert.cl" }, |
| 364 | { "RGB888_to_NV12_bt709", "color_convert.cl" }, |
| 365 | { "RGB888_to_RGBA8888_bt709", "color_convert.cl" }, |
Manuel Bottini | acaf21d | 2018-09-26 17:38:19 +0100 | [diff] [blame] | 366 | { "RGB888_to_U8_bt709", "color_convert.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 367 | { "RGB888_to_YUV444_bt709", "color_convert.cl" }, |
| 368 | { "RGBA8888_to_IYUV_bt709", "color_convert.cl" }, |
| 369 | { "RGBA8888_to_NV12_bt709", "color_convert.cl" }, |
| 370 | { "RGBA8888_to_RGB888_bt709", "color_convert.cl" }, |
| 371 | { "RGBA8888_to_YUV444_bt709", "color_convert.cl" }, |
giuros01 | 1887081 | 2018-09-13 09:31:40 +0100 | [diff] [blame] | 372 | { "roi_align_layer", "roi_align_layer.cl" }, |
SiCong Li | 3e36369 | 2017-07-04 15:02:10 +0100 | [diff] [blame] | 373 | { "roi_pooling_layer", "roi_pooling_layer.cl" }, |
Michalis Spyrou | 46da23f | 2018-04-10 13:41:30 +0100 | [diff] [blame] | 374 | { "scale_nearest_neighbour_nchw", "scale.cl" }, |
| 375 | { "scale_nearest_neighbour_nhwc", "scale.cl" }, |
| 376 | { "scale_bilinear_nchw", "scale.cl" }, |
| 377 | { "scale_bilinear_nhwc", "scale.cl" }, |
Michalis Spyrou | 17220e2 | 2018-09-12 13:35:38 +0100 | [diff] [blame] | 378 | { "scale_bilinear_quantized_nchw", "scale_quantized.cl" }, |
| 379 | { "scale_bilinear_quantized_nhwc", "scale_quantized.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 380 | { "scharr3x3", "scharr_filter.cl" }, |
| 381 | { "sobel3x3", "sobel_filter.cl" }, |
| 382 | { "sobel_separable5x1", "sobel_filter.cl" }, |
| 383 | { "sobel_separable1x5", "sobel_filter.cl" }, |
| 384 | { "sobel_separable7x1", "sobel_filter.cl" }, |
| 385 | { "sobel_separable1x7", "sobel_filter.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 386 | { "softmax_layer_norm", "softmax_layer.cl" }, |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 387 | { "softmax_layer_norm_quantized", "softmax_layer_quantized.cl" }, |
Giorgio Arena | 4402cb9 | 2018-02-15 13:37:40 +0000 | [diff] [blame] | 388 | { "softmax_layer_max_shift_exp_sum_quantized_serial", "softmax_layer_quantized.cl" }, |
| 389 | { "softmax_layer_max_shift_exp_sum_quantized_parallel", "softmax_layer_quantized.cl" }, |
Chunosov | d6afedc | 2017-11-06 22:09:45 +0700 | [diff] [blame] | 390 | { "softmax_layer_max_shift_exp_sum_serial", "softmax_layer.cl" }, |
Michalis Spyrou | 13a51e1 | 2018-09-18 13:09:30 +0100 | [diff] [blame] | 391 | { "space_to_batch_nchw", "space_to_batch.cl" }, |
| 392 | { "space_to_batch_static_nchw", "space_to_batch.cl" }, |
| 393 | { "space_to_batch_nhwc", "space_to_batch.cl" }, |
| 394 | { "space_to_batch_static_nhwc", "space_to_batch.cl" }, |
Chunosov | d6afedc | 2017-11-06 22:09:45 +0700 | [diff] [blame] | 395 | { "softmax_layer_max_shift_exp_sum_parallel", "softmax_layer.cl" }, |
Georgios Pinitas | c1a7245 | 2018-08-24 11:25:32 +0100 | [diff] [blame] | 396 | { "strided_slice", "slice_ops.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 397 | { "suppress_non_maximum", "canny.cl" }, |
| 398 | { "tablelookup_U8", "tablelookup.cl" }, |
| 399 | { "tablelookup_S16", "tablelookup.cl" }, |
| 400 | { "threshold_binary", "threshold.cl" }, |
| 401 | { "threshold_range", "threshold.cl" }, |
| 402 | { "transpose", "transpose.cl" }, |
| 403 | { "UYVY422_to_IYUV_bt709", "color_convert.cl" }, |
| 404 | { "UYVY422_to_NV12_bt709", "color_convert.cl" }, |
| 405 | { "UYVY422_to_RGB888_bt709", "color_convert.cl" }, |
| 406 | { "UYVY422_to_RGBA8888_bt709", "color_convert.cl" }, |
Michalis Spyrou | ceb889e | 2018-09-17 18:24:41 +0100 | [diff] [blame] | 407 | { "upsample_layer_nchw", "upsample_layer.cl" }, |
| 408 | { "upsample_layer_nhwc", "upsample_layer.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 409 | { "warp_affine_nearest_neighbour", "warp_affine.cl" }, |
| 410 | { "warp_affine_bilinear", "warp_affine.cl" }, |
| 411 | { "warp_perspective_nearest_neighbour", "warp_perspective.cl" }, |
| 412 | { "warp_perspective_bilinear", "warp_perspective.cl" }, |
Giorgio Arena | a50e5e0 | 2018-07-02 13:42:23 +0100 | [diff] [blame] | 413 | { "winograd_filter_transform_2x2_3x3_nchw", "winograd_filter_transform.cl" }, |
| 414 | { "winograd_filter_transform_2x1_3x1_nchw", "winograd_filter_transform.cl" }, |
| 415 | { "winograd_filter_transform_1x2_1x3_nchw", "winograd_filter_transform.cl" }, |
| 416 | { "winograd_filter_transform_4x4_3x3_nchw", "winograd_filter_transform.cl" }, |
| 417 | { "winograd_filter_transform_4x1_3x1_nchw", "winograd_filter_transform.cl" }, |
| 418 | { "winograd_filter_transform_1x4_1x3_nchw", "winograd_filter_transform.cl" }, |
| 419 | { "winograd_filter_transform_4x4_5x5_nchw", "winograd_filter_transform.cl" }, |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 420 | { "winograd_filter_transform_4x1_5x1_nchw", "winograd_filter_transform.cl" }, |
| 421 | { "winograd_filter_transform_1x4_1x5_nchw", "winograd_filter_transform.cl" }, |
Giorgio Arena | 149fdf3 | 2018-07-04 17:03:33 +0100 | [diff] [blame] | 422 | { "winograd_filter_transform_4x1_3x1_nhwc", "winograd_filter_transform.cl" }, |
| 423 | { "winograd_filter_transform_1x4_1x3_nhwc", "winograd_filter_transform.cl" }, |
Giorgio Arena | a50e5e0 | 2018-07-02 13:42:23 +0100 | [diff] [blame] | 424 | { "winograd_filter_transform_4x4_3x3_nhwc", "winograd_filter_transform.cl" }, |
| 425 | { "winograd_filter_transform_4x4_5x5_nhwc", "winograd_filter_transform.cl" }, |
Gian Marco Iodice | d28b751 | 2018-07-06 12:59:28 +0100 | [diff] [blame] | 426 | { "winograd_filter_transform_4x1_5x1_nhwc", "winograd_filter_transform.cl" }, |
| 427 | { "winograd_filter_transform_1x4_1x5_nhwc", "winograd_filter_transform.cl" }, |
Giorgio Arena | a50e5e0 | 2018-07-02 13:42:23 +0100 | [diff] [blame] | 428 | { "winograd_input_transform_2x2_3x3_stepz1_nchw", "winograd_input_transform.cl" }, |
| 429 | { "winograd_input_transform_2x2_3x3_stepz2_nchw", "winograd_input_transform.cl" }, |
| 430 | { "winograd_input_transform_2x1_3x1_stepz1_nchw", "winograd_input_transform.cl" }, |
| 431 | { "winograd_input_transform_2x1_3x1_stepz2_nchw", "winograd_input_transform.cl" }, |
| 432 | { "winograd_input_transform_1x2_1x3_stepz1_nchw", "winograd_input_transform.cl" }, |
| 433 | { "winograd_input_transform_1x2_1x3_stepz2_nchw", "winograd_input_transform.cl" }, |
| 434 | { "winograd_input_transform_4x4_3x3_stepz1_nchw", "winograd_input_transform.cl" }, |
| 435 | { "winograd_input_transform_4x1_3x1_stepz1_nchw", "winograd_input_transform.cl" }, |
| 436 | { "winograd_input_transform_1x4_1x3_stepz1_nchw", "winograd_input_transform.cl" }, |
| 437 | { "winograd_input_transform_4x4_5x5_stepz1_nchw", "winograd_input_transform.cl" }, |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 438 | { "winograd_input_transform_4x1_5x1_stepz1_nchw", "winograd_input_transform.cl" }, |
| 439 | { "winograd_input_transform_1x4_1x5_stepz1_nchw", "winograd_input_transform.cl" }, |
Giorgio Arena | 149fdf3 | 2018-07-04 17:03:33 +0100 | [diff] [blame] | 440 | { "winograd_input_transform_4x1_3x1_stepz1_nhwc", "winograd_input_transform.cl" }, |
| 441 | { "winograd_input_transform_1x4_1x3_stepz1_nhwc", "winograd_input_transform.cl" }, |
Giorgio Arena | a50e5e0 | 2018-07-02 13:42:23 +0100 | [diff] [blame] | 442 | { "winograd_input_transform_4x4_3x3_stepz1_nhwc", "winograd_input_transform.cl" }, |
| 443 | { "winograd_input_transform_4x4_5x5_stepz1_nhwc", "winograd_input_transform.cl" }, |
Gian Marco Iodice | d28b751 | 2018-07-06 12:59:28 +0100 | [diff] [blame] | 444 | { "winograd_input_transform_4x1_5x1_stepz1_nhwc", "winograd_input_transform.cl" }, |
| 445 | { "winograd_input_transform_1x4_1x5_stepz1_nhwc", "winograd_input_transform.cl" }, |
Giorgio Arena | a50e5e0 | 2018-07-02 13:42:23 +0100 | [diff] [blame] | 446 | { "winograd_output_transform_2x2_3x3_nchw", "winograd_output_transform.cl" }, |
| 447 | { "winograd_output_transform_2x1_3x1_nchw", "winograd_output_transform.cl" }, |
| 448 | { "winograd_output_transform_1x2_1x3_nchw", "winograd_output_transform.cl" }, |
| 449 | { "winograd_output_transform_4x4_3x3_nchw", "winograd_output_transform.cl" }, |
| 450 | { "winograd_output_transform_4x1_3x1_nchw", "winograd_output_transform.cl" }, |
| 451 | { "winograd_output_transform_1x4_1x3_nchw", "winograd_output_transform.cl" }, |
| 452 | { "winograd_output_transform_4x4_5x5_nchw", "winograd_output_transform.cl" }, |
Gian Marco Iodice | 876be2a | 2018-07-03 12:22:09 +0100 | [diff] [blame] | 453 | { "winograd_output_transform_4x1_5x1_nchw", "winograd_output_transform.cl" }, |
| 454 | { "winograd_output_transform_1x4_1x5_nchw", "winograd_output_transform.cl" }, |
Giorgio Arena | 149fdf3 | 2018-07-04 17:03:33 +0100 | [diff] [blame] | 455 | { "winograd_output_transform_4x1_3x1_nhwc", "winograd_output_transform.cl" }, |
| 456 | { "winograd_output_transform_1x4_1x3_nhwc", "winograd_output_transform.cl" }, |
Giorgio Arena | a50e5e0 | 2018-07-02 13:42:23 +0100 | [diff] [blame] | 457 | { "winograd_output_transform_4x4_3x3_nhwc", "winograd_output_transform.cl" }, |
| 458 | { "winograd_output_transform_4x4_5x5_nhwc", "winograd_output_transform.cl" }, |
Gian Marco Iodice | d28b751 | 2018-07-06 12:59:28 +0100 | [diff] [blame] | 459 | { "winograd_output_transform_4x1_5x1_nhwc", "winograd_output_transform.cl" }, |
| 460 | { "winograd_output_transform_1x4_1x5_nhwc", "winograd_output_transform.cl" }, |
Giorgio Arena | 7302302 | 2018-09-04 14:55:55 +0100 | [diff] [blame] | 461 | { "yolo_layer_nchw", "yolo_layer.cl" }, |
| 462 | { "yolo_layer_nhwc", "yolo_layer.cl" }, |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 463 | { "YUYV422_to_IYUV_bt709", "color_convert.cl" }, |
| 464 | { "YUYV422_to_NV12_bt709", "color_convert.cl" }, |
| 465 | { "YUYV422_to_RGB888_bt709", "color_convert.cl" }, |
| 466 | { "YUYV422_to_RGBA8888_bt709", "color_convert.cl" }, |
| 467 | }; |
| 468 | |
| 469 | const std::map<std::string, std::string> CLKernelLibrary::_program_source_map = |
| 470 | { |
| 471 | #ifdef EMBEDDED_KERNELS |
| 472 | { |
| 473 | "absdiff.cl", |
| 474 | #include "./cl_kernels/absdiff.clembed" |
| 475 | }, |
| 476 | { |
| 477 | "accumulate.cl", |
| 478 | #include "./cl_kernels/accumulate.clembed" |
| 479 | }, |
| 480 | { |
| 481 | "activation_layer.cl", |
| 482 | #include "./cl_kernels/activation_layer.clembed" |
| 483 | }, |
| 484 | { |
Michel Iwaniec | 0063380 | 2017-10-12 14:14:15 +0100 | [diff] [blame] | 485 | "activation_layer_qa8.cl", |
| 486 | #include "./cl_kernels/activation_layer_qa8.clembed" |
| 487 | }, |
| 488 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 489 | "arithmetic_op.cl", |
| 490 | #include "./cl_kernels/arithmetic_op.clembed" |
| 491 | }, |
| 492 | { |
Michele Di Giorgio | 4622ac1 | 2018-06-27 16:41:17 +0100 | [diff] [blame] | 493 | "arithmetic_op_quantized.cl", |
| 494 | #include "./cl_kernels/arithmetic_op_quantized.clembed" |
| 495 | }, |
| 496 | { |
Michalis Spyrou | 6a8d3b6 | 2018-08-31 10:07:09 +0100 | [diff] [blame] | 497 | "batch_to_space.cl", |
| 498 | #include "./cl_kernels/batch_to_space.clembed" |
| 499 | }, |
| 500 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 501 | "bitwise_op.cl", |
| 502 | #include "./cl_kernels/bitwise_op.clembed" |
| 503 | }, |
| 504 | { |
giuros01 | c04a0e8 | 2018-10-03 12:44:35 +0100 | [diff] [blame] | 505 | "bounding_box_transform.cl", |
| 506 | #include "./cl_kernels/bounding_box_transform.clembed" |
| 507 | }, |
| 508 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 509 | "canny.cl", |
| 510 | #include "./cl_kernels/canny.clembed" |
| 511 | }, |
| 512 | { |
| 513 | "channel_combine.cl", |
| 514 | #include "./cl_kernels/channel_combine.clembed" |
| 515 | }, |
| 516 | { |
| 517 | "channel_extract.cl", |
| 518 | #include "./cl_kernels/channel_extract.clembed" |
| 519 | }, |
| 520 | { |
Michele Di Giorgio | 7217563 | 2018-05-01 16:52:00 +0100 | [diff] [blame] | 521 | "channel_shuffle.cl", |
| 522 | #include "./cl_kernels/channel_shuffle.clembed" |
| 523 | }, |
| 524 | { |
Gian Marco | 76faef8 | 2018-01-29 12:15:32 +0000 | [diff] [blame] | 525 | "col2im.cl", |
| 526 | #include "./cl_kernels/col2im.clembed" |
| 527 | }, |
| 528 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 529 | "concatenate.cl", |
| 530 | #include "./cl_kernels/concatenate.clembed" |
| 531 | }, |
| 532 | { |
| 533 | "color_convert.cl", |
| 534 | #include "./cl_kernels/color_convert.clembed" |
| 535 | }, |
| 536 | { |
Giorgio Arena | 657bdb3 | 2018-04-26 18:52:01 +0100 | [diff] [blame] | 537 | "convert_fc_weights.cl", |
| 538 | #include "./cl_kernels/convert_fc_weights.clembed" |
| 539 | }, |
| 540 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 541 | "convolution3x3.cl", |
| 542 | #include "./cl_kernels/convolution3x3.clembed" |
| 543 | }, |
| 544 | { |
| 545 | "convolution5x5.cl", |
| 546 | #include "./cl_kernels/convolution5x5.clembed" |
| 547 | }, |
| 548 | { |
| 549 | "convolution7x7.cl", |
| 550 | #include "./cl_kernels/convolution7x7.clembed" |
| 551 | }, |
| 552 | { |
| 553 | "convolution9x9.cl", |
| 554 | #include "./cl_kernels/convolution9x9.clembed" |
| 555 | }, |
| 556 | { |
| 557 | "convolution_layer.cl", |
| 558 | #include "./cl_kernels/convolution_layer.clembed" |
| 559 | }, |
| 560 | { |
| 561 | "convolution_rectangle.cl", |
| 562 | #include "./cl_kernels/convolution_rectangle.clembed" |
| 563 | }, |
| 564 | { |
Michalis Spyrou | 5c8e05c | 2018-03-22 11:56:01 +0000 | [diff] [blame] | 565 | "copy_tensor.cl", |
| 566 | #include "./cl_kernels/copy_tensor.clembed" |
| 567 | }, |
| 568 | { |
Michalis Spyrou | ceb889e | 2018-09-17 18:24:41 +0100 | [diff] [blame] | 569 | "upsample_layer.cl", |
| 570 | #include "./cl_kernels/upsample_layer.clembed" |
| 571 | }, |
| 572 | { |
Michalis Spyrou | 780db4e | 2017-11-23 09:49:51 +0000 | [diff] [blame] | 573 | "deconvolution_layer.cl", |
| 574 | #include "./cl_kernels/deconvolution_layer.clembed" |
| 575 | }, |
| 576 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 577 | "depth_convert.cl", |
| 578 | #include "./cl_kernels/depth_convert.clembed" |
| 579 | }, |
| 580 | { |
Giorgio Arena | 93a690e | 2017-08-01 16:09:33 +0100 | [diff] [blame] | 581 | "depthwise_convolution.cl", |
| 582 | #include "./cl_kernels/depthwise_convolution.clembed" |
| 583 | }, |
| 584 | { |
Dmitry Savenko | d7295b7 | 2017-11-20 22:00:08 +0700 | [diff] [blame] | 585 | "depthwise_convolution_quantized.cl", |
| 586 | #include "./cl_kernels/depthwise_convolution_quantized.clembed" |
| 587 | }, |
| 588 | { |
Michele Di Giorgio | 56dd726 | 2017-07-27 09:53:49 +0100 | [diff] [blame] | 589 | "dequantization_layer.cl", |
| 590 | #include "./cl_kernels/dequantization_layer.clembed" |
| 591 | }, |
| 592 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 593 | "derivative.cl", |
| 594 | #include "./cl_kernels/derivative.clembed" |
| 595 | }, |
| 596 | { |
| 597 | "dilate.cl", |
| 598 | #include "./cl_kernels/dilate.clembed" |
| 599 | }, |
| 600 | { |
SiCong Li | c51b72f | 2017-07-28 14:46:20 +0100 | [diff] [blame] | 601 | "direct_convolution1x1.cl", |
| 602 | #include "./cl_kernels/direct_convolution1x1.clembed" |
| 603 | }, |
| 604 | { |
| 605 | "direct_convolution3x3.cl", |
| 606 | #include "./cl_kernels/direct_convolution3x3.clembed" |
steniu01 | 27b386c | 2017-07-18 17:37:43 +0100 | [diff] [blame] | 607 | }, |
| 608 | { |
steniu01 | db00668 | 2017-08-09 16:26:22 +0100 | [diff] [blame] | 609 | "direct_convolution5x5.cl", |
| 610 | #include "./cl_kernels/direct_convolution5x5.clembed" |
| 611 | }, |
| 612 | { |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 613 | "direct_convolution_1x1_3x3_5x5_quantized.cl", |
| 614 | #include "./cl_kernels/direct_convolution_1x1_3x3_5x5_quantized.clembed" |
| 615 | }, |
| 616 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 617 | "erode.cl", |
| 618 | #include "./cl_kernels/erode.clembed" |
| 619 | }, |
| 620 | { |
| 621 | "fast_corners.cl", |
| 622 | #include "./cl_kernels/fast_corners.clembed" |
| 623 | }, |
| 624 | { |
Gian Marco Iodice | 215b4ea | 2018-06-28 16:29:29 +0100 | [diff] [blame] | 625 | "flatten.cl", |
| 626 | #include "./cl_kernels/flatten.clembed" |
| 627 | }, |
| 628 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 629 | "fill_border.cl", |
| 630 | #include "./cl_kernels/fill_border.clembed" |
| 631 | }, |
| 632 | { |
Georgios Pinitas | d8e765b | 2017-08-02 13:44:33 +0100 | [diff] [blame] | 633 | "floor.cl", |
| 634 | #include "./cl_kernels/floor.clembed" |
| 635 | }, |
| 636 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 637 | "gaussian_pyramid.cl", |
| 638 | #include "./cl_kernels/gaussian_pyramid.clembed" |
| 639 | }, |
| 640 | { |
| 641 | "gemm.cl", |
| 642 | #include "./cl_kernels/gemm.clembed" |
| 643 | }, |
| 644 | { |
Gian Marco | 05288a2 | 2017-11-21 10:57:50 +0000 | [diff] [blame] | 645 | "gemmlowp.cl", |
| 646 | #include "./cl_kernels/gemmlowp.clembed" |
| 647 | }, |
| 648 | { |
Giorgio Arena | 9fe4144 | 2017-08-23 16:36:24 +0100 | [diff] [blame] | 649 | "gemv.cl", |
| 650 | #include "./cl_kernels/gemv.clembed" |
| 651 | }, |
| 652 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 653 | "harris_corners.cl", |
| 654 | #include "./cl_kernels/harris_corners.clembed" |
| 655 | }, |
| 656 | { |
| 657 | "helpers.h", |
| 658 | #include "./cl_kernels/helpers.hembed" |
| 659 | }, |
| 660 | { |
Chunosov | d621bca | 2017-11-03 17:33:15 +0700 | [diff] [blame] | 661 | "helpers_asymm.h", |
| 662 | #include "./cl_kernels/helpers_asymm.hembed" |
| 663 | }, |
| 664 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 665 | "histogram.cl", |
| 666 | #include "./cl_kernels/histogram.clembed" |
| 667 | }, |
| 668 | { |
| 669 | "hog.cl", |
| 670 | #include "./cl_kernels/hog.clembed" |
| 671 | }, |
| 672 | { |
Gian Marco | 76faef8 | 2018-01-29 12:15:32 +0000 | [diff] [blame] | 673 | "im2col.cl", |
| 674 | #include "./cl_kernels/im2col.clembed" |
| 675 | }, |
| 676 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 677 | "integral_image.cl", |
| 678 | #include "./cl_kernels/integral_image.clembed" |
| 679 | }, |
| 680 | { |
Michalis Spyrou | 04f089c | 2017-08-08 17:42:38 +0100 | [diff] [blame] | 681 | "l2_normalize.cl", |
| 682 | #include "./cl_kernels/l2_normalize.clembed" |
| 683 | }, |
| 684 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 685 | "magnitude_phase.cl", |
| 686 | #include "./cl_kernels/magnitude_phase.clembed" |
| 687 | }, |
| 688 | { |
| 689 | "mean_stddev.cl", |
| 690 | #include "./cl_kernels/mean_stddev.clembed" |
| 691 | }, |
| 692 | { |
Giuseppe Rossini | d7647d4 | 2018-07-17 18:13:13 +0100 | [diff] [blame] | 693 | "memset.cl", |
| 694 | #include "./cl_kernels/memset.clembed" |
| 695 | }, |
| 696 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 697 | "minmaxloc.cl", |
| 698 | #include "./cl_kernels/minmaxloc.clembed" |
| 699 | }, |
| 700 | { |
Michele Di Giorgio | 56dd726 | 2017-07-27 09:53:49 +0100 | [diff] [blame] | 701 | "minmax_layer.cl", |
| 702 | #include "./cl_kernels/minmax_layer.clembed" |
| 703 | }, |
| 704 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 705 | "non_linear_filter3x3.cl", |
| 706 | #include "./cl_kernels/non_linear_filter3x3.clembed" |
| 707 | }, |
| 708 | { |
| 709 | "non_linear_filter5x5.cl", |
| 710 | #include "./cl_kernels/non_linear_filter5x5.clembed" |
| 711 | }, |
| 712 | { |
| 713 | "non_linear_filter_helpers.h", |
| 714 | #include "./cl_kernels/non_linear_filter_helpers.hembed" |
| 715 | }, |
| 716 | { |
| 717 | "nonmax.cl", |
| 718 | #include "./cl_kernels/nonmax.clembed" |
| 719 | }, |
| 720 | { |
| 721 | "normalization_layer.cl", |
| 722 | #include "./cl_kernels/normalization_layer.clembed" |
| 723 | }, |
| 724 | { |
Michele Di Giorgio | b57be0d | 2018-08-31 16:26:25 +0100 | [diff] [blame] | 725 | "normalize_planar_yuv_layer.cl", |
| 726 | #include "./cl_kernels/normalize_planar_yuv_layer.clembed" |
| 727 | }, |
| 728 | { |
Michele Di Giorgio | d63dfa2 | 2018-09-12 10:18:54 +0100 | [diff] [blame] | 729 | "normalize_planar_yuv_layer_quantized.cl", |
| 730 | #include "./cl_kernels/normalize_planar_yuv_layer_quantized.clembed" |
| 731 | }, |
| 732 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 733 | "batchnormalization_layer.cl", |
| 734 | #include "./cl_kernels/batchnormalization_layer.clembed" |
| 735 | }, |
| 736 | { |
| 737 | "optical_flow_pyramid_lk.cl", |
| 738 | #include "./cl_kernels/optical_flow_pyramid_lk.clembed" |
| 739 | }, |
| 740 | { |
Michalis Spyrou | 5237e01 | 2018-01-17 09:40:27 +0000 | [diff] [blame] | 741 | "permute.cl", |
| 742 | #include "./cl_kernels/permute.clembed" |
| 743 | }, |
| 744 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 745 | "pixelwise_mul_float.cl", |
| 746 | #include "./cl_kernels/pixelwise_mul_float.clembed" |
| 747 | }, |
| 748 | { |
| 749 | "pixelwise_mul_int.cl", |
| 750 | #include "./cl_kernels/pixelwise_mul_int.clembed" |
| 751 | }, |
| 752 | { |
| 753 | "pooling_layer.cl", |
| 754 | #include "./cl_kernels/pooling_layer.clembed" |
| 755 | }, |
| 756 | { |
Anton Lokhmotov | af6204c | 2017-11-08 09:34:19 +0000 | [diff] [blame] | 757 | "pooling_layer_quantized.cl", |
| 758 | #include "./cl_kernels/pooling_layer_quantized.clembed" |
| 759 | }, |
| 760 | { |
Michele Di Giorgio | 56dd726 | 2017-07-27 09:53:49 +0100 | [diff] [blame] | 761 | "quantization_layer.cl", |
| 762 | #include "./cl_kernels/quantization_layer.clembed" |
| 763 | }, |
| 764 | { |
Michalis Spyrou | 04f089c | 2017-08-08 17:42:38 +0100 | [diff] [blame] | 765 | "reduction_operation.cl", |
| 766 | #include "./cl_kernels/reduction_operation.clembed" |
| 767 | }, |
| 768 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 769 | "remap.cl", |
| 770 | #include "./cl_kernels/remap.clembed" |
| 771 | }, |
| 772 | { |
Gian Marco Iodice | 477531c | 2018-08-21 17:53:38 +0100 | [diff] [blame] | 773 | "reorg_layer.cl", |
| 774 | #include "./cl_kernels/reorg_layer.clembed" |
| 775 | }, |
| 776 | { |
Georgios Pinitas | 5ee66ea | 2017-09-07 17:29:16 +0100 | [diff] [blame] | 777 | "reshape_layer.cl", |
| 778 | #include "./cl_kernels/reshape_layer.clembed" |
| 779 | }, |
| 780 | { |
giuros01 | 1887081 | 2018-09-13 09:31:40 +0100 | [diff] [blame] | 781 | "roi_align_layer.cl", |
| 782 | #include "./cl_kernels/roi_align_layer.clembed" |
| 783 | }, |
| 784 | { |
SiCong Li | 3e36369 | 2017-07-04 15:02:10 +0100 | [diff] [blame] | 785 | "roi_pooling_layer.cl", |
| 786 | #include "./cl_kernels/roi_pooling_layer.clembed" |
| 787 | }, |
| 788 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 789 | "scale.cl", |
| 790 | #include "./cl_kernels/scale.clembed" |
| 791 | }, |
| 792 | { |
Michalis Spyrou | 17220e2 | 2018-09-12 13:35:38 +0100 | [diff] [blame] | 793 | "scale_quantized.cl", |
| 794 | #include "./cl_kernels/scale_quantized.clembed" |
| 795 | }, |
| 796 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 797 | "scharr_filter.cl", |
| 798 | #include "./cl_kernels/scharr_filter.clembed" |
| 799 | }, |
| 800 | { |
| 801 | "sobel_filter.cl", |
| 802 | #include "./cl_kernels/sobel_filter.clembed" |
| 803 | }, |
| 804 | { |
| 805 | "softmax_layer.cl", |
| 806 | #include "./cl_kernels/softmax_layer.clembed" |
| 807 | }, |
| 808 | { |
Chunosov | f450caa | 2017-11-08 16:09:35 +0700 | [diff] [blame] | 809 | "softmax_layer_quantized.cl", |
| 810 | #include "./cl_kernels/softmax_layer_quantized.clembed" |
| 811 | }, |
| 812 | { |
Georgios Pinitas | c1a7245 | 2018-08-24 11:25:32 +0100 | [diff] [blame] | 813 | "slice_ops.cl", |
| 814 | #include "./cl_kernels/slice_ops.clembed" |
Georgios Pinitas | 77589b5 | 2018-08-21 14:41:35 +0100 | [diff] [blame] | 815 | }, |
| 816 | { |
Michalis Spyrou | 16934a5 | 2018-08-21 18:03:58 +0100 | [diff] [blame] | 817 | "space_to_batch.cl", |
| 818 | #include "./cl_kernels/space_to_batch.clembed" |
| 819 | }, |
| 820 | { |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 821 | "tablelookup.cl", |
| 822 | #include "./cl_kernels/tablelookup.clembed" |
| 823 | }, |
| 824 | { |
| 825 | "threshold.cl", |
| 826 | #include "./cl_kernels/threshold.clembed" |
| 827 | }, |
| 828 | { |
| 829 | "transpose.cl", |
| 830 | #include "./cl_kernels/transpose.clembed" |
| 831 | }, |
| 832 | { |
| 833 | "types.h", |
| 834 | #include "./cl_kernels/types.hembed" |
| 835 | }, |
| 836 | { |
| 837 | "warp_affine.cl", |
| 838 | #include "./cl_kernels/warp_affine.clembed" |
| 839 | }, |
| 840 | { |
| 841 | "warp_helpers.h", |
| 842 | #include "./cl_kernels/warp_helpers.hembed" |
| 843 | }, |
| 844 | { |
| 845 | "warp_perspective.cl", |
| 846 | #include "./cl_kernels/warp_perspective.clembed" |
Michalis Spyrou | d7e8281 | 2017-06-20 15:00:14 +0100 | [diff] [blame] | 847 | }, |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 848 | { |
Giorgio Arena | a50e5e0 | 2018-07-02 13:42:23 +0100 | [diff] [blame] | 849 | "winograd_filter_transform.cl", |
| 850 | #include "./cl_kernels/winograd_filter_transform.clembed" |
| 851 | }, |
| 852 | { |
| 853 | "winograd_input_transform.cl", |
| 854 | #include "./cl_kernels/winograd_input_transform.clembed" |
| 855 | }, |
| 856 | { |
| 857 | "winograd_output_transform.cl", |
| 858 | #include "./cl_kernels/winograd_output_transform.clembed" |
Giorgio Arena | 1f9ca1d | 2018-03-01 11:13:45 +0000 | [diff] [blame] | 859 | }, |
Giorgio Arena | 7302302 | 2018-09-04 14:55:55 +0100 | [diff] [blame] | 860 | { |
| 861 | "yolo_layer.cl", |
| 862 | #include "./cl_kernels/yolo_layer.clembed" |
| 863 | }, |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 864 | #endif /* EMBEDDED_KERNELS */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 865 | }; |
| 866 | |
| 867 | CLKernelLibrary::CLKernelLibrary() |
Abel Bernabeu | 5a6e053 | 2017-09-28 09:53:45 +0100 | [diff] [blame] | 868 | : _context(), _device(), _kernel_path("."), _programs_map(), _built_programs_map() |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 869 | { |
Anthony Barbier | ecb1c62 | 2018-04-17 11:45:10 +0100 | [diff] [blame] | 870 | opencl_is_available(); // Make sure the OpenCL symbols are initialised *before* the CLKernelLibrary is built |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 871 | } |
| 872 | |
| 873 | CLKernelLibrary &CLKernelLibrary::get() |
| 874 | { |
| 875 | static CLKernelLibrary _kernel_library; |
| 876 | return _kernel_library; |
| 877 | } |
| 878 | |
| 879 | Kernel CLKernelLibrary::create_kernel(const std::string &kernel_name, const StringSet &build_options_set) const |
| 880 | { |
| 881 | // Find which program contains the kernel |
| 882 | auto kernel_program_it = _kernel_program_map.find(kernel_name); |
| 883 | |
| 884 | if(_kernel_program_map.end() == kernel_program_it) |
| 885 | { |
| 886 | ARM_COMPUTE_ERROR("Kernel %s not found in the CLKernelLibrary", kernel_name.c_str()); |
| 887 | } |
steniu01 | 3470247 | 2017-07-11 09:22:58 +0100 | [diff] [blame] | 888 | std::string concat_str; |
| 889 | |
Georgios Pinitas | df473ea | 2018-05-31 18:53:52 +0100 | [diff] [blame] | 890 | #if defined(ARM_COMPUTE_DEBUG_ENABLED) |
| 891 | // Enable debug properties in CL kernels |
| 892 | concat_str += " -DARM_COMPUTE_DEBUG_ENABLED"; |
| 893 | #endif // defined(ARM_COMPUTE_DEBUG_ENABLED) |
| 894 | |
Vidhya Sudhan Loganathan | f1f4906 | 2018-05-25 13:21:26 +0100 | [diff] [blame] | 895 | if(fp16_supported()) |
Matthew Bentham | 6f31f8c | 2017-10-27 11:50:06 +0100 | [diff] [blame] | 896 | { |
| 897 | concat_str += " -DARM_COMPUTE_OPENCL_FP16_ENABLED=1 "; |
| 898 | } |
| 899 | |
Michalis Spyrou | e03342e | 2018-01-15 14:39:13 +0000 | [diff] [blame] | 900 | if(dot8_supported(_device)) |
| 901 | { |
| 902 | concat_str += " -DARM_COMPUTE_OPENCL_DOT8_ENABLED=1 "; |
| 903 | } |
| 904 | |
Giorgio Arena | eff8d95 | 2018-07-02 15:29:57 +0100 | [diff] [blame] | 905 | if(dot8_acc_supported(_device)) |
| 906 | { |
| 907 | concat_str += " -DARM_COMPUTE_OPENCL_DOT8_ACC_ENABLED=1 "; |
| 908 | } |
| 909 | |
Pablo Tello | e86a09f | 2018-01-11 15:44:48 +0000 | [diff] [blame] | 910 | if(get_cl_version(_device) == CLVersion::CL20) |
steniu01 | 3470247 | 2017-07-11 09:22:58 +0100 | [diff] [blame] | 911 | { |
| 912 | concat_str += " -cl-std=CL2.0 "; |
| 913 | } |
Anthony Barbier | d727e85 | 2018-04-20 11:05:29 +0100 | [diff] [blame] | 914 | else if(arm_non_uniform_workgroup_supported(_device)) |
Pablo Tello | e86a09f | 2018-01-11 15:44:48 +0000 | [diff] [blame] | 915 | { |
| 916 | concat_str += " -cl-arm-non-uniform-work-group-size "; |
| 917 | } |
steniu01 | 3470247 | 2017-07-11 09:22:58 +0100 | [diff] [blame] | 918 | else |
| 919 | { |
| 920 | ARM_COMPUTE_ERROR("Non uniform workgroup size is not supported!!"); |
| 921 | } |
| 922 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 923 | // Check if the program has been built before with same build options. |
steniu01 | 3470247 | 2017-07-11 09:22:58 +0100 | [diff] [blame] | 924 | const std::string program_name = kernel_program_it->second; |
| 925 | const std::string build_options = stringify_set(build_options_set) + concat_str; |
| 926 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 927 | const std::string built_program_name = program_name + "_" + build_options; |
| 928 | auto built_program_it = _built_programs_map.find(built_program_name); |
| 929 | |
| 930 | cl::Program cl_program; |
| 931 | |
| 932 | if(_built_programs_map.end() != built_program_it) |
| 933 | { |
| 934 | // If program has been built, retrieve to create kernel from it |
| 935 | cl_program = built_program_it->second; |
| 936 | } |
| 937 | else |
| 938 | { |
| 939 | // Get program |
| 940 | Program program = load_program(program_name); |
| 941 | |
| 942 | // Build program |
| 943 | cl_program = program.build(build_options); |
| 944 | |
| 945 | // Add built program to internal map |
| 946 | _built_programs_map.emplace(built_program_name, cl_program); |
| 947 | } |
| 948 | |
| 949 | // Create and return kernel |
| 950 | return Kernel(kernel_name, cl_program); |
| 951 | } |
| 952 | |
Anthony Barbier | 7da55aa | 2018-04-13 16:58:43 +0100 | [diff] [blame] | 953 | void CLKernelLibrary::add_built_program(const std::string &built_program_name, cl::Program program) |
| 954 | { |
| 955 | _built_programs_map.emplace(built_program_name, program); |
| 956 | } |
| 957 | |
Vidhya Sudhan Loganathan | f1f4906 | 2018-05-25 13:21:26 +0100 | [diff] [blame] | 958 | bool CLKernelLibrary::fp16_supported() const |
| 959 | { |
| 960 | return ::fp16_supported(_device); |
| 961 | } |
| 962 | |
Vidhya Sudhan Loganathan | 76c8564 | 2018-05-25 13:53:02 +0100 | [diff] [blame] | 963 | bool CLKernelLibrary::int64_base_atomics_supported() const |
| 964 | { |
| 965 | return device_supports_extension(_device, "cl_khr_int64_base_atomics"); |
| 966 | } |
| 967 | |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 968 | const Program &CLKernelLibrary::load_program(const std::string &program_name) const |
| 969 | { |
| 970 | const auto program_it = _programs_map.find(program_name); |
| 971 | |
| 972 | if(program_it != _programs_map.end()) |
| 973 | { |
| 974 | return program_it->second; |
| 975 | } |
| 976 | |
| 977 | Program program; |
| 978 | |
| 979 | #ifdef EMBEDDED_KERNELS |
| 980 | const auto program_source_it = _program_source_map.find(program_name); |
| 981 | |
| 982 | if(_program_source_map.end() == program_source_it) |
| 983 | { |
| 984 | ARM_COMPUTE_ERROR("Embedded program for %s does not exist.", program_name.c_str()); |
| 985 | } |
| 986 | |
| 987 | program = Program(_context, program_name, program_source_it->second); |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 988 | #else /* EMBEDDED_KERNELS */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 989 | // Check for binary |
| 990 | std::string source_name = _kernel_path + program_name; |
| 991 | std::string binary_name = source_name + "bin"; |
| 992 | |
| 993 | if(std::ifstream(binary_name).is_open()) |
| 994 | { |
| 995 | const std::string program_binary = read_file(binary_name, true); |
| 996 | program = Program(_context, _device, program_name, std::vector<unsigned char>(program_binary.begin(), program_binary.end())); |
| 997 | } |
| 998 | else if(std::ifstream(source_name).is_open()) |
| 999 | { |
| 1000 | program = Program(_context, program_name, read_file(source_name, false)); |
| 1001 | } |
| 1002 | else |
| 1003 | { |
| 1004 | ARM_COMPUTE_ERROR("Kernel file %s does not exist.", source_name.c_str()); |
| 1005 | } |
Anthony Barbier | ac69aa1 | 2017-07-03 17:39:37 +0100 | [diff] [blame] | 1006 | #endif /* EMBEDDED_KERNELS */ |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1007 | |
| 1008 | // Insert program to program map |
| 1009 | const auto new_program = _programs_map.emplace(program_name, std::move(program)); |
| 1010 | |
| 1011 | return new_program.first->second; |
| 1012 | } |
| 1013 | |
| 1014 | std::string CLKernelLibrary::stringify_set(const StringSet &s) const |
| 1015 | { |
steniu01 | 3470247 | 2017-07-11 09:22:58 +0100 | [diff] [blame] | 1016 | std::string concat_set; |
Anthony Barbier | 6ff3b19 | 2017-09-04 18:44:23 +0100 | [diff] [blame] | 1017 | |
| 1018 | #ifndef EMBEDDED_KERNELS |
| 1019 | concat_set += "-I" + _kernel_path + " "; |
| 1020 | #endif /* EMBEDDED_KERNELS */ |
| 1021 | |
| 1022 | // Concatenate set |
| 1023 | for(const auto &el : s) |
| 1024 | { |
| 1025 | concat_set += " " + el; |
| 1026 | } |
| 1027 | |
| 1028 | return concat_set; |
| 1029 | } |
Michalis Spyrou | d7e8281 | 2017-06-20 15:00:14 +0100 | [diff] [blame] | 1030 | |
| 1031 | std::string CLKernelLibrary::get_program_source(const std::string &program_name) |
| 1032 | { |
| 1033 | const auto program_source_it = _program_source_map.find(program_name); |
| 1034 | |
| 1035 | if(program_source_it == _program_source_map.end()) |
| 1036 | { |
| 1037 | ARM_COMPUTE_ERROR("Embedded program for %s does not exist.", program_name.c_str()); |
| 1038 | } |
| 1039 | |
| 1040 | return program_source_it->second; |
| 1041 | } |
steniu01 | 5f91072 | 2017-08-23 10:15:22 +0100 | [diff] [blame] | 1042 | |
Abel Bernabeu | 5a6e053 | 2017-09-28 09:53:45 +0100 | [diff] [blame] | 1043 | size_t CLKernelLibrary::max_local_workgroup_size(const cl::Kernel &kernel) const |
steniu01 | 5f91072 | 2017-08-23 10:15:22 +0100 | [diff] [blame] | 1044 | { |
Abel Bernabeu | 5a6e053 | 2017-09-28 09:53:45 +0100 | [diff] [blame] | 1045 | size_t result; |
steniu01 | 5f91072 | 2017-08-23 10:15:22 +0100 | [diff] [blame] | 1046 | |
Abel Bernabeu | 5a6e053 | 2017-09-28 09:53:45 +0100 | [diff] [blame] | 1047 | size_t err = kernel.getWorkGroupInfo(_device, CL_KERNEL_WORK_GROUP_SIZE, &result); |
| 1048 | ARM_COMPUTE_ERROR_ON_MSG(err != 0, "clGetKernelWorkGroupInfo failed to return the maximum workgroup size for the kernel"); |
| 1049 | ARM_COMPUTE_UNUSED(err); |
| 1050 | |
| 1051 | return result; |
steniu01 | 5f91072 | 2017-08-23 10:15:22 +0100 | [diff] [blame] | 1052 | } |
| 1053 | |
Abel Bernabeu | 5a6e053 | 2017-09-28 09:53:45 +0100 | [diff] [blame] | 1054 | cl::NDRange CLKernelLibrary::default_ndrange() const |
steniu01 | 5f91072 | 2017-08-23 10:15:22 +0100 | [diff] [blame] | 1055 | { |
Anthony Barbier | b6eb353 | 2018-08-08 13:20:04 +0100 | [diff] [blame] | 1056 | GPUTarget _target = get_target_from_device(_device); |
Michalis Spyrou | a967611 | 2018-02-22 18:07:43 +0000 | [diff] [blame] | 1057 | cl::NDRange default_range; |
| 1058 | |
| 1059 | switch(_target) |
| 1060 | { |
| 1061 | case GPUTarget::MIDGARD: |
| 1062 | case GPUTarget::T600: |
| 1063 | case GPUTarget::T700: |
| 1064 | case GPUTarget::T800: |
| 1065 | default_range = cl::NDRange(128u, 1); |
| 1066 | break; |
| 1067 | default: |
| 1068 | default_range = cl::NullRange; |
| 1069 | } |
| 1070 | |
| 1071 | return default_range; |
steniu01 | 5f91072 | 2017-08-23 10:15:22 +0100 | [diff] [blame] | 1072 | } |
Anthony Barbier | 847864d | 2018-03-07 11:35:53 +0000 | [diff] [blame] | 1073 | |
| 1074 | std::string CLKernelLibrary::get_device_version() |
| 1075 | { |
| 1076 | return _device.getInfo<CL_DEVICE_VERSION>(); |
| 1077 | } |