Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 1 | /* |
Gian Marco Iodice | 10e88a7 | 2021-11-29 12:49:19 +0000 | [diff] [blame] | 2 | * Copyright (c) 2016-2022 Arm Limited. |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +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 | */ |
Georgios Pinitas | 7891a73 | 2021-08-20 21:39:25 +0100 | [diff] [blame] | 24 | #include "src/gpu/cl/ClKernelLibrary.h" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 25 | |
| 26 | #include "arm_compute/core/Error.h" |
| 27 | #include "arm_compute/core/Utils.h" |
| 28 | |
| 29 | #include <algorithm> |
| 30 | #include <array> |
| 31 | #include <fstream> |
| 32 | #include <utility> |
| 33 | |
| 34 | #ifdef ARM_COMPUTE_COMPRESSED_KERNELS |
| 35 | #include <zlib.h> |
| 36 | |
| 37 | namespace |
| 38 | { |
| 39 | /* Decoding table */ |
| 40 | constexpr std::array<uint8_t, 256> b64_invtab = |
| 41 | { |
| 42 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 43 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 44 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, |
| 45 | 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, |
| 46 | 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
| 47 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, |
| 48 | 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
| 49 | 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, |
| 50 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 51 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 52 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 53 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 54 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 55 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 56 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 57 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 58 | }; |
| 59 | |
| 60 | /** Decode a base64 encoded string |
| 61 | * |
| 62 | * @param[in] str Base64 encoded string to decode |
| 63 | * |
| 64 | * @return The decode string in case of a valid, non-empty string otherwise an empty string |
| 65 | */ |
| 66 | std::string decode_base64(const std::string &str) |
| 67 | { |
| 68 | constexpr const char pad_char = '='; |
| 69 | |
| 70 | // Handle empty string |
| 71 | if(str.empty()) |
| 72 | { |
| 73 | return {}; |
| 74 | } |
| 75 | |
| 76 | // Base64 encoded string has size multiple of 4 |
| 77 | if(str.length() % 4) |
| 78 | { |
| 79 | return {}; |
| 80 | } |
| 81 | |
| 82 | // |
| 83 | // Check encoded string padding |
| 84 | std::size_t padding = (str.rbegin()[0] == pad_char) + (str.rbegin()[1] == pad_char); |
| 85 | const int str_len = str.size(); |
| 86 | |
| 87 | // Reserve memory for the decoded string |
| 88 | // Note each 4 consecutive elements of 6-bit encode 3 bytes |
| 89 | std::string dec_b64; |
| 90 | dec_b64.reserve(((str_len / 4) * 3)); |
| 91 | |
| 92 | // Block decoding function (exclude padding) |
| 93 | int c = 0; |
| 94 | const int end = str_len - 4 - padding; |
| 95 | for(; c <= end; c += 4) |
| 96 | { |
| 97 | const int byte0 = b64_invtab[str[c]]; |
| 98 | const int byte1 = b64_invtab[str[c + 1]]; |
| 99 | const int byte2 = b64_invtab[str[c + 2]]; |
| 100 | const int byte3 = b64_invtab[str[c + 3]]; |
| 101 | |
| 102 | dec_b64.push_back((byte0 << 2) | (byte1 >> 4)); |
| 103 | dec_b64.push_back((byte1 << 4) | (byte2 >> 2)); |
| 104 | dec_b64.push_back((byte2 << 6) | (byte3)); |
| 105 | } |
| 106 | |
| 107 | // Last step that might contain padding symbols |
| 108 | if(padding == 1) |
| 109 | { |
| 110 | const int byte0 = b64_invtab[str[c]]; |
| 111 | const int byte1 = b64_invtab[str[c + 1]]; |
| 112 | const int byte2 = b64_invtab[str[c + 2]]; |
| 113 | |
| 114 | dec_b64.push_back((byte0 << 2) | (byte1 >> 4)); |
| 115 | dec_b64.push_back((byte1 << 4) | (byte2 >> 2)); |
| 116 | } |
| 117 | else if(padding == 2) |
| 118 | { |
| 119 | const int byte0 = b64_invtab[str[c]]; |
| 120 | const int byte1 = b64_invtab[str[c + 1]]; |
| 121 | |
| 122 | dec_b64.push_back((byte0 << 2) | (byte1 >> 4)); |
| 123 | } |
| 124 | |
| 125 | return dec_b64; |
| 126 | } |
| 127 | |
| 128 | /** Decompress a zlib compressed string |
| 129 | * |
| 130 | * @param[in] str ZLib compressed string |
| 131 | * |
| 132 | * @return The decompressed string if successful, otherwise false. |
| 133 | */ |
| 134 | std::string decompress_zlib(const std::string &str) |
| 135 | { |
| 136 | // Create and initialize decompression stream |
| 137 | z_stream ds{}; |
| 138 | if(inflateInit(&ds) != Z_OK) |
| 139 | { |
| 140 | return std::string(); |
| 141 | } |
| 142 | ds.avail_in = str.size(); |
| 143 | ds.next_in = (Bytef *)str.data(); |
| 144 | |
| 145 | // Roll-over the string using a buffer and decompress |
| 146 | int status = Z_OK; |
| 147 | char roll_buff[16384]; |
| 148 | std::string inflated_str; |
| 149 | do |
| 150 | { |
| 151 | ds.avail_out = sizeof(roll_buff); |
| 152 | ds.next_out = reinterpret_cast<Bytef *>(roll_buff); |
| 153 | |
| 154 | status = inflate(&ds, 0); |
| 155 | if(inflated_str.size() < ds.total_out) |
| 156 | { |
| 157 | inflated_str.append(roll_buff, ds.total_out - inflated_str.size()); |
| 158 | } |
| 159 | } |
| 160 | while(status == Z_OK); |
| 161 | |
| 162 | // Finalize decompression stream |
| 163 | inflateEnd(&ds); |
| 164 | if(status != Z_STREAM_END) |
| 165 | { |
| 166 | return std::string(); |
| 167 | } |
| 168 | |
| 169 | return inflated_str; |
| 170 | } |
| 171 | } // namespace |
| 172 | #endif /* ARM_COMPUTE_COMPRESSED_KERNELS */ |
| 173 | |
| 174 | namespace arm_compute |
| 175 | { |
| 176 | namespace opencl |
| 177 | { |
| 178 | const std::map<std::string, std::string> ClKernelLibrary::_kernel_program_map = |
| 179 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 180 | // Common Kernels |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 181 | { "activation_layer", "common/activation_layer.cl" }, |
| 182 | { "activation_layer_quant", "common/activation_layer_quant.cl" }, |
| 183 | { "activation_layer_quant_f32", "common/activation_layer_quant.cl" }, |
| 184 | { "arg_min_max_x", "common/arg_min_max.cl" }, |
| 185 | { "arg_min_max_y", "common/arg_min_max.cl" }, |
| 186 | { "arg_min_max_z", "common/arg_min_max.cl" }, |
| 187 | { "arg_min_max_w", "common/arg_min_max.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 188 | { "bitwise_or", "common/bitwise_op.cl" }, |
| 189 | { "bitwise_and", "common/bitwise_op.cl" }, |
| 190 | { "bitwise_xor", "common/bitwise_op.cl" }, |
| 191 | { "bitwise_not", "common/bitwise_op.cl" }, |
| 192 | { "bounding_box_transform", "common/bounding_box_transform.cl" }, |
| 193 | { "bounding_box_transform_quantized", "common/bounding_box_transform_quantized.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 194 | { "compare_equal", "common/comparisons.cl" }, |
| 195 | { "compare_equal_quantized", "common/comparisons.cl" }, |
| 196 | { "compare_notequal", "common/comparisons.cl" }, |
| 197 | { "compare_notequal_quantized", "common/comparisons.cl" }, |
| 198 | { "compare_greater", "common/comparisons.cl" }, |
| 199 | { "compare_greater_quantized", "common/comparisons.cl" }, |
| 200 | { "compare_greaterequal", "common/comparisons.cl" }, |
| 201 | { "compare_greaterequal_quantized", "common/comparisons.cl" }, |
| 202 | { "compare_less", "common/comparisons.cl" }, |
| 203 | { "compare_less_quantized", "common/comparisons.cl" }, |
| 204 | { "compare_lessequal", "common/comparisons.cl" }, |
| 205 | { "compare_lessequal_quantized", "common/comparisons.cl" }, |
| 206 | { "concatenate", "common/concatenate.cl" }, |
| 207 | { "concatenate_width", "common/concatenate.cl" }, |
| 208 | { "concatenate_height", "common/concatenate.cl" }, |
| 209 | { "concatenate_width_x2", "common/concatenate.cl" }, |
| 210 | { "concatenate_width_x4", "common/concatenate.cl" }, |
| 211 | { "col2im", "common/col2im.cl" }, |
| 212 | { "cast_down", "common/cast.cl" }, |
| 213 | { "cast_up", "common/cast.cl" }, |
| 214 | { "convert_fc_weights", "common/convert_fc_weights.cl" }, |
| 215 | { "copy_tensor", "common/copy_tensor.cl" }, |
| 216 | { "crop_tensor", "common/crop_tensor.cl" }, |
| 217 | { "deconvolution_reshape", "common/deconvolution_layer.cl" }, |
| 218 | { "deconvolution_upsample", "common/deconvolution_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 219 | { "dequantization_layer", "common/dequantization_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 220 | { "elementwise_operation_ADD", "common/elementwise_operation.cl" }, |
| 221 | { "elementwise_operation_SUB", "common/elementwise_operation.cl" }, |
| 222 | { "elementwise_operation_MAX", "common/elementwise_operation.cl" }, |
| 223 | { "elementwise_operation_MIN", "common/elementwise_operation.cl" }, |
| 224 | { "elementwise_operation_DIV", "common/elementwise_operation.cl" }, |
| 225 | { "elementwise_operation_SQUARED_DIFF", "common/elementwise_operation.cl" }, |
| 226 | { "elementwise_operation_POWER", "common/elementwise_operation.cl" }, |
| 227 | { "elementwise_operation_PRELU", "common/elementwise_operation.cl" }, |
| 228 | { "elementwise_operation_AND", "common/elementwise_operation.cl" }, |
| 229 | { "elementwise_operation_OR", "common/elementwise_operation.cl" }, |
| 230 | { "elementwise_operation_ADD_quantized", "common/elementwise_operation_quantized.cl" }, |
| 231 | { "elementwise_operation_SUB_quantized", "common/elementwise_operation_quantized.cl" }, |
| 232 | { "elementwise_operation_MAX_quantized", "common/elementwise_operation_quantized.cl" }, |
| 233 | { "elementwise_operation_MIN_quantized", "common/elementwise_operation_quantized.cl" }, |
| 234 | { "elementwise_operation_DIV_quantized", "common/elementwise_operation_quantized.cl" }, |
| 235 | { "elementwise_operation_SQUARED_DIFF_quantized", "common/elementwise_operation_quantized.cl" }, |
| 236 | { "elementwise_operation_PRELU_quantized", "common/elementwise_operation_quantized.cl" }, |
| 237 | { "elementwise_unary", "common/elementwise_unary.cl" }, |
| 238 | { "fft_digit_reverse_axis_0", "common/fft_digit_reverse.cl" }, |
| 239 | { "fft_digit_reverse_axis_1", "common/fft_digit_reverse.cl" }, |
| 240 | { "fft_radix_2_first_stage_axis_0", "common/fft.cl" }, |
| 241 | { "fft_radix_2_first_stage_axis_1", "common/fft.cl" }, |
| 242 | { "fft_radix_2_axis_0", "common/fft.cl" }, |
| 243 | { "fft_radix_2_axis_1", "common/fft.cl" }, |
| 244 | { "fft_radix_3_first_stage_axis_0", "common/fft.cl" }, |
| 245 | { "fft_radix_3_first_stage_axis_1", "common/fft.cl" }, |
| 246 | { "fft_radix_3_axis_0", "common/fft.cl" }, |
| 247 | { "fft_radix_3_axis_1", "common/fft.cl" }, |
| 248 | { "fft_radix_4_first_stage_axis_0", "common/fft.cl" }, |
| 249 | { "fft_radix_4_first_stage_axis_1", "common/fft.cl" }, |
| 250 | { "fft_radix_4_axis_0", "common/fft.cl" }, |
| 251 | { "fft_radix_4_axis_1", "common/fft.cl" }, |
| 252 | { "fft_radix_5_first_stage_axis_0", "common/fft.cl" }, |
| 253 | { "fft_radix_5_first_stage_axis_1", "common/fft.cl" }, |
| 254 | { "fft_radix_5_axis_0", "common/fft.cl" }, |
| 255 | { "fft_radix_5_axis_1", "common/fft.cl" }, |
| 256 | { "fft_radix_7_first_stage_axis_0", "common/fft.cl" }, |
| 257 | { "fft_radix_7_first_stage_axis_1", "common/fft.cl" }, |
| 258 | { "fft_radix_7_axis_0", "common/fft.cl" }, |
| 259 | { "fft_radix_7_axis_1", "common/fft.cl" }, |
| 260 | { "fft_radix_8_first_stage_axis_0", "common/fft.cl" }, |
| 261 | { "fft_radix_8_first_stage_axis_1", "common/fft.cl" }, |
| 262 | { "fft_radix_8_axis_0", "common/fft.cl" }, |
| 263 | { "fft_radix_8_axis_1", "common/fft.cl" }, |
| 264 | { "fft_scale_conj", "common/fft_scale.cl" }, |
| 265 | { "fill_image_borders_constant", "common/fill_border.cl" }, |
| 266 | { "fill_image_borders_replicate", "common/fill_border.cl" }, |
| 267 | { "floor_layer", "common/floor.cl" }, |
| 268 | { "fuse_batchnormalization_layer", "common/batchnormalization_layer.cl" }, |
| 269 | { "gather", "common/gather.cl" }, |
| 270 | { "gemm_ma_f16", "common/gemm.cl" }, |
| 271 | { "gemm_ma_f32", "common/gemm.cl" }, |
| 272 | { "gemm_mv", "common/gemv.cl" }, |
| 273 | { "gemm_mv_quantized", "common/gemv.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 274 | { "gemm_mm_native", "common/gemm.cl" }, |
SiCongLi | afa1972 | 2021-10-24 19:12:33 +0100 | [diff] [blame] | 275 | { "gemm_mm_native_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_native.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 276 | { "gemm_mm_reshaped_lhs_nt_rhs_t", "common/gemm.cl" }, |
| 277 | { "gemm_mm_reshaped_lhs_nt_rhs_t_texture", "common/gemm.cl" }, |
| 278 | { "gemm_mm_reshaped_lhs_t_rhs_nt", "common/gemm.cl" }, |
| 279 | { "gemm_mm_reshaped_lhs_t_rhs_nt_texture", "common/gemm.cl" }, |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 280 | { "gemm_mm_reshaped_lhs_nt_rhs_t_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped.cl" }, |
| 281 | { "gemm_mm_reshaped_lhs_nt_rhs_t_texture_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped.cl" }, |
| 282 | { "gemm_mm_reshaped_lhs_t_rhs_nt_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped.cl" }, |
| 283 | { "gemm_mm_reshaped_lhs_t_rhs_nt_texture_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped.cl" }, |
Ramy Elgammal | 451c309 | 2022-02-01 23:01:27 +0000 | [diff] [blame] | 284 | { "gemm_mm_reshaped_only_rhs_nt", "common/gemm.cl" }, |
| 285 | { "gemm_mm_reshaped_only_rhs_nt_texture", "common/gemm.cl" }, |
| 286 | { "gemm_mm_reshaped_only_rhs_t", "common/gemm.cl" }, |
| 287 | { "gemm_mm_reshaped_only_rhs_t_texture", "common/gemm.cl" }, |
| 288 | { "gemm_mm_reshaped_only_rhs_nt_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped_only_rhs.cl" }, |
| 289 | { "gemm_mm_reshaped_only_rhs_nt_texture_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped_only_rhs.cl" }, |
| 290 | { "gemm_mm_reshaped_only_rhs_t_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped_only_rhs.cl" }, |
| 291 | { "gemm_mm_reshaped_only_rhs_t_texture_post_act_eltwise_op_act", "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped_only_rhs.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 292 | { "gemm_lc_vm_f32", "common/gemm.cl" }, |
ramelg01 | 9cca592 | 2021-11-11 10:05:00 +0000 | [diff] [blame] | 293 | { "gemm_reshape_lhs_matrix_nt", "common/gemm_utils.cl" }, |
| 294 | { "gemm_reshape_lhs_matrix_t", "common/gemm_utils.cl" }, |
| 295 | { "gemm_reshape_rhs_matrix_nt", "common/gemm_utils.cl" }, |
| 296 | { "gemm_reshape_rhs_matrix_t", "common/gemm_utils.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 297 | { "gemmlowp_matrix_a_reduction", "common/gemmlowp.cl" }, |
| 298 | { "gemmlowp_matrix_a_reduction_dot8", "common/gemmlowp.cl" }, |
| 299 | { "gemmlowp_matrix_b_reduction", "common/gemmlowp.cl" }, |
| 300 | { "gemmlowp_mm_native", "common/gemmlowp.cl" }, |
| 301 | { "gemmlowp_mm_reshaped_lhs_nt_rhs_t", "common/gemmlowp.cl" }, |
| 302 | { "gemmlowp_mm_reshaped_only_rhs_t", "common/gemmlowp.cl" }, |
| 303 | { "gemmlowp_mm_reshaped_only_rhs_t_fused_output_stage_fixedpoint", "common/gemmlowp.cl" }, |
| 304 | { "gemmlowp_offset_contribution", "common/gemmlowp.cl" }, |
| 305 | { "gemmlowp_offset_contribution_quantize_down", "common/gemmlowp.cl" }, |
| 306 | { "gemmlowp_offset_contribution_quantize_down_fixedpoint", "common/gemmlowp.cl" }, |
| 307 | { "gemmlowp_output_stage_quantize_down", "common/gemmlowp.cl" }, |
| 308 | { "gemmlowp_output_stage_quantize_down_fixedpoint", "common/gemmlowp.cl" }, |
| 309 | { "gemmlowp_output_stage_quantize_down_fixedpoint_qsymm16", "common/gemmlowp.cl" }, |
| 310 | { "gemmlowp_output_stage_quantize_down_float", "common/gemmlowp.cl" }, |
| 311 | { "generate_proposals_compute_all_anchors", "common/generate_proposals.cl" }, |
| 312 | { "generate_proposals_compute_all_anchors_quantized", "common/generate_proposals_quantized.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 313 | { "instance_normalization", "common/instance_normalization.cl" }, |
| 314 | { "compute_mean_var", "common/instance_normalization.cl" }, |
| 315 | { "l2_normalize_x", "common/l2_normalize.cl" }, |
| 316 | { "l2_normalize_y", "common/l2_normalize.cl" }, |
| 317 | { "l2_normalize_z", "common/l2_normalize.cl" }, |
| 318 | { "max_unpooling_layer_2", "common/unpooling_layer.cl" }, |
| 319 | { "mean_stddev_normalization", "common/mean_stddev_normalization.cl" }, |
| 320 | { "memset", "common/memset.cl" }, |
| 321 | { "minmax_layer", "common/minmax_layer.cl" }, |
| 322 | { "non_max_suppression", "common/nonmax.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 323 | { "pad_layer_constant", "common/pad_layer.cl" }, |
| 324 | { "pad_layer_symmetric_reflect", "common/pad_layer.cl" }, |
| 325 | { "permute", "common/permute.cl" }, |
| 326 | { "pixelwise_mul_complex", "common/pixelwise_mul_float.cl" }, |
| 327 | { "pixelwise_mul_float", "common/pixelwise_mul_float.cl" }, |
| 328 | { "pixelwise_mul_int", "common/pixelwise_mul_int.cl" }, |
| 329 | { "pixelwise_mul_quantized", "common/pixelwise_mul_int.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 330 | { "qlstm_layer_normalization", "common/qlstm_layer_normalization.cl" }, |
| 331 | { "quantization_layer", "common/quantization_layer.cl" }, |
| 332 | { "range", "common/range.cl" }, |
| 333 | { "range_quantized", "common/range.cl" }, |
| 334 | { "reduction_operation_x", "common/reduction_operation.cl" }, |
| 335 | { "reduction_operation_non_parallel_x", "common/reduction_operation.cl" }, |
| 336 | { "reduction_operation_y", "common/reduction_operation.cl" }, |
| 337 | { "reduction_operation_z", "common/reduction_operation.cl" }, |
| 338 | { "reduction_operation_w", "common/reduction_operation.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 339 | { "reshape_layer", "common/reshape_layer.cl" }, |
| 340 | { "reshape_to_columns", "common/convolution_layer.cl" }, |
| 341 | { "reverse", "common/reverse.cl" }, |
| 342 | { "roi_align_layer", "common/roi_align_layer.cl" }, |
| 343 | { "roi_align_layer_quantized", "common/roi_align_layer_quantized.cl" }, |
| 344 | { "roi_pooling_layer", "common/roi_pooling_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 345 | { "select_same_rank", "common/select.cl" }, |
| 346 | { "select_different_rank_2", "common/select.cl" }, |
| 347 | { "select_different_rank_n", "common/select.cl" }, |
| 348 | { "softmax_layer_norm", "common/softmax_layer.cl" }, |
| 349 | { "softmax_layer_norm_quantized", "common/softmax_layer_quantized.cl" }, |
| 350 | { "softmax_layer_max_shift_exp_sum_quantized_serial", "common/softmax_layer_quantized.cl" }, |
| 351 | { "softmax_layer_max_shift_exp_sum_quantized_parallel", "common/softmax_layer_quantized.cl" }, |
| 352 | { "softmax_layer_max_shift_exp_sum_serial", "common/softmax_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 353 | { "softmax_layer_max_shift_exp_sum_parallel", "common/softmax_layer.cl" }, |
| 354 | { "stack_layer", "common/stack_layer.cl" }, |
| 355 | { "strided_slice", "common/slice_ops.cl" }, |
| 356 | { "tile", "common/tile.cl" }, |
| 357 | { "transpose", "common/transpose.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 358 | #ifdef ENABLE_NCHW_KERNELS |
| 359 | { "batch_to_space_nchw", "nchw/batch_to_space.cl" }, |
| 360 | { "batch_to_space_static_nchw", "nchw/batch_to_space.cl" }, |
| 361 | { "batchnormalization_layer_nchw", "nchw/batchnormalization_layer.cl" }, |
| 362 | { "channel_shuffle_nchw", "nchw/channel_shuffle.cl" }, |
| 363 | { "depth_to_space_nchw", "nchw/depth_to_space.cl" }, |
| 364 | { "dequantization_layer_per_channel_nchw", "nchw/dequantization_layer.cl" }, |
| 365 | { "direct_convolution1x1", "nchw/direct_convolution1x1.cl" }, |
Adnan AlSinan | 3012435 | 2021-12-02 19:12:20 +0000 | [diff] [blame] | 366 | { "direct_convolution_nchw", "nchw/direct_convolution.cl" }, |
| 367 | |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 368 | { "im2col1x1_stridex1_nchw", "nchw/im2col.cl" }, |
| 369 | { "im2col3x3_nchw", "nchw/im2col.cl" }, |
| 370 | { "im2col5x5_nchw", "nchw/im2col.cl" }, |
| 371 | { "im2col11x11_padx0_pady0_nchw", "nchw/im2col.cl" }, |
| 372 | { "im2col_generic_nchw", "nchw/im2col.cl" }, |
| 373 | { "im2col_generic_padx0_pady0_nchw", "nchw/im2col.cl" }, |
| 374 | { "normalization_layer_cross_map_nchw", "nchw/normalization_layer.cl" }, |
| 375 | { "normalization_layer_in_map_nchw", "nchw/normalization_layer.cl" }, |
| 376 | { "normalize_planar_yuv_layer_nchw", "nchw/normalize_planar_yuv_layer.cl" }, |
| 377 | { "normalize_planar_yuv_layer_q8_nchw", "nchw/normalize_planar_yuv_layer_quantized.cl" }, |
| 378 | { "pooling_layer_MxN_nchw", "nchw/pooling_layer.cl" }, |
Giorgio Arena | 8fce496 | 2021-09-01 14:05:00 +0100 | [diff] [blame] | 379 | { "pooling_layer_2_nchw_indices", "nchw/pooling_layer.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 380 | { "prior_box_layer_nchw", "nchw/prior_box_layer.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 381 | { "reorg_layer_nchw", "nchw/reorg_layer.cl" }, |
| 382 | { "scale_nearest_neighbour_nchw", "nchw/scale.cl" }, |
| 383 | { "scale_bilinear_nchw", "nchw/scale.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 384 | { "space_to_batch_nchw", "nchw/space_to_batch.cl" }, |
| 385 | { "space_to_batch_static_nchw", "nchw/space_to_batch.cl" }, |
| 386 | { "space_to_depth_nchw", "nchw/space_to_depth.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 387 | { "upsample_layer_nchw", "nchw/upsample_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 388 | { "winograd_filter_transform_2x2_3x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 389 | { "winograd_filter_transform_2x1_3x1_nchw", "nchw/winograd_filter_transform.cl" }, |
| 390 | { "winograd_filter_transform_1x2_1x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 391 | { "winograd_filter_transform_4x4_3x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 392 | { "winograd_filter_transform_4x1_3x1_nchw", "nchw/winograd_filter_transform.cl" }, |
| 393 | { "winograd_filter_transform_1x4_1x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 394 | { "winograd_filter_transform_4x4_5x5_nchw", "nchw/winograd_filter_transform.cl" }, |
| 395 | { "winograd_filter_transform_4x1_5x1_nchw", "nchw/winograd_filter_transform.cl" }, |
| 396 | { "winograd_filter_transform_1x4_1x5_nchw", "nchw/winograd_filter_transform.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 397 | { "winograd_input_transform_2x2_3x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 398 | { "winograd_input_transform_2x2_3x3_stepz2_nchw", "nchw/winograd_input_transform.cl" }, |
| 399 | { "winograd_input_transform_2x1_3x1_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 400 | { "winograd_input_transform_2x1_3x1_stepz2_nchw", "nchw/winograd_input_transform.cl" }, |
| 401 | { "winograd_input_transform_1x2_1x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 402 | { "winograd_input_transform_1x2_1x3_stepz2_nchw", "nchw/winograd_input_transform.cl" }, |
| 403 | { "winograd_input_transform_4x4_3x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 404 | { "winograd_input_transform_4x1_3x1_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 405 | { "winograd_input_transform_1x4_1x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 406 | { "winograd_input_transform_4x4_5x5_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 407 | { "winograd_input_transform_4x1_5x1_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 408 | { "winograd_input_transform_1x4_1x5_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 409 | { "winograd_output_transform_2x2_3x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 410 | { "winograd_output_transform_2x1_3x1_nchw", "nchw/winograd_output_transform.cl" }, |
| 411 | { "winograd_output_transform_1x2_1x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 412 | { "winograd_output_transform_4x4_3x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 413 | { "winograd_output_transform_4x1_3x1_nchw", "nchw/winograd_output_transform.cl" }, |
| 414 | { "winograd_output_transform_1x4_1x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 415 | { "winograd_output_transform_4x4_5x5_nchw", "nchw/winograd_output_transform.cl" }, |
| 416 | { "winograd_output_transform_4x1_5x1_nchw", "nchw/winograd_output_transform.cl" }, |
| 417 | { "winograd_output_transform_1x4_1x5_nchw", "nchw/winograd_output_transform.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 418 | #endif /* ENABLE_NCHW_KERNELS */ |
| 419 | #ifdef ENABLE_NHWC_KERNELS |
| 420 | { "batch_to_space_nhwc", "nhwc/batch_to_space.cl" }, |
| 421 | { "batch_to_space_static_nhwc", "nhwc/batch_to_space.cl" }, |
| 422 | { "batchnormalization_layer_nhwc", "nhwc/batchnormalization_layer.cl" }, |
| 423 | { "channel_shuffle_nhwc", "nhwc/channel_shuffle.cl" }, |
| 424 | { "depth_to_space_nhwc", "nhwc/depth_to_space.cl" }, |
| 425 | { "dequantization_layer_per_channel_nhwc", "nhwc/dequantization_layer.cl" }, |
| 426 | { "dwc_native_fp_nhwc", "nhwc/dwc_native_fp_nhwc.cl" }, |
| 427 | { "dwc_native_quantized_nhwc", "nhwc/dwc_native_quantized_nhwc.cl" }, |
| 428 | { "direct_convolution_nhwc", "nhwc/direct_convolution.cl" }, |
Giorgio Arena | 945ae9e | 2021-10-13 11:13:04 +0100 | [diff] [blame] | 429 | { "direct_convolution3d_ndhwc", "nhwc/direct_convolution3d.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 430 | { "im2col3x3_nhwc", "nhwc/im2col.cl" }, |
| 431 | { "im2col9x9_nhwc", "nhwc/im2col.cl" }, |
| 432 | { "im2col_generic_nhwc", "nhwc/im2col.cl" }, |
| 433 | { "normalization_layer_cross_map_nhwc", "nhwc/normalization_layer.cl" }, |
| 434 | { "normalization_layer_in_map_nhwc", "nhwc/normalization_layer.cl" }, |
| 435 | { "normalize_planar_yuv_layer_nhwc", "nhwc/normalize_planar_yuv_layer.cl" }, |
| 436 | { "normalize_planar_yuv_layer_q8_nhwc", "nhwc/normalize_planar_yuv_layer_quantized.cl" }, |
| 437 | { "pooling_layer_MxN_nhwc", "nhwc/pooling_layer.cl" }, |
| 438 | { "pooling_layer_2x2_nhwc", "nhwc/pooling_layer.cl" }, |
| 439 | { "pooling_layer_MxN_quantized_nhwc", "nhwc/pooling_layer_quantized.cl" }, |
ramelg01 | 3751569 | 2022-02-26 22:06:20 +0000 | [diff] [blame] | 440 | { "pooling_3d_layer_MxN_ndhwc", "nhwc/pooling_3d_layer.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 441 | { "reorg_layer_nhwc", "nhwc/reorg_layer.cl" }, |
| 442 | { "scale_nearest_neighbour_nhwc", "nhwc/scale.cl" }, |
| 443 | { "scale_bilinear_nhwc", "nhwc/scale.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 444 | { "space_to_batch_nhwc", "nhwc/space_to_batch.cl" }, |
| 445 | { "space_to_batch_static_nhwc", "nhwc/space_to_batch.cl" }, |
| 446 | { "space_to_depth_nhwc", "nhwc/space_to_depth.cl" }, |
| 447 | { "upsample_layer_nhwc", "nhwc/upsample_layer.cl" }, |
| 448 | { "winograd_filter_transform_4x1_3x1_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 449 | { "winograd_filter_transform_1x4_1x3_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 450 | { "winograd_filter_transform_4x4_3x3_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 451 | { "winograd_filter_transform_4x4_5x5_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 452 | { "winograd_filter_transform_4x1_5x1_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 453 | { "winograd_filter_transform_1x4_1x5_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 454 | { "winograd_filter_transform_2x2_7x7_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 455 | { "winograd_filter_transform_2x1_7x1_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 456 | { "winograd_filter_transform_1x2_1x7_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 457 | { "winograd_input_transform_4x1_3x1_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 458 | { "winograd_input_transform_1x4_1x3_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 459 | { "winograd_input_transform_4x4_3x3_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 460 | { "winograd_input_transform_4x4_5x5_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 461 | { "winograd_input_transform_4x1_5x1_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 462 | { "winograd_input_transform_1x4_1x5_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 463 | { "winograd_input_transform_2x2_7x7_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 464 | { "winograd_input_transform_2x1_7x1_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 465 | { "winograd_input_transform_1x2_1x7_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 466 | { "winograd_output_transform_4x1_3x1_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 467 | { "winograd_output_transform_1x4_1x3_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 468 | { "winograd_output_transform_4x4_3x3_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 469 | { "winograd_output_transform_4x4_5x5_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 470 | { "winograd_output_transform_4x1_5x1_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 471 | { "winograd_output_transform_1x4_1x5_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 472 | { "winograd_output_transform_2x2_7x7_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 473 | { "winograd_output_transform_2x1_7x1_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 474 | { "winograd_output_transform_1x2_1x7_nhwc", "nhwc/winograd_output_transform.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 475 | #endif /* ENABLE_NHWC_KERNELS */ |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 476 | }; |
| 477 | |
| 478 | const std::map<std::string, std::string> ClKernelLibrary::_program_source_map = |
| 479 | { |
| 480 | #ifdef EMBEDDED_KERNELS |
| 481 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 482 | "common/activation_layer.cl", |
| 483 | #include "./cl_kernels/common/activation_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 484 | }, |
| 485 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 486 | "common/activation_layer_quant.cl", |
| 487 | #include "./cl_kernels/common/activation_layer_quant.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 488 | }, |
| 489 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 490 | "common/arg_min_max.cl", |
| 491 | #include "./cl_kernels/common/arg_min_max.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 492 | }, |
| 493 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 494 | "common/bitwise_op.cl", |
| 495 | #include "./cl_kernels/common/bitwise_op.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 496 | }, |
| 497 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 498 | "common/bounding_box_transform.cl", |
| 499 | #include "./cl_kernels/common/bounding_box_transform.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 500 | }, |
| 501 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 502 | "common/bounding_box_transform_quantized.cl", |
| 503 | #include "./cl_kernels/common/bounding_box_transform_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 504 | }, |
| 505 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 506 | "common/col2im.cl", |
| 507 | #include "./cl_kernels/common/col2im.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 508 | }, |
| 509 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 510 | "common/comparisons.cl", |
| 511 | #include "./cl_kernels/common/comparisons.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 512 | }, |
| 513 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 514 | "common/concatenate.cl", |
| 515 | #include "./cl_kernels/common/concatenate.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 516 | }, |
| 517 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 518 | "common/convert_fc_weights.cl", |
| 519 | #include "./cl_kernels/common/convert_fc_weights.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 520 | }, |
| 521 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 522 | "common/convolution_layer.cl", |
| 523 | #include "./cl_kernels/common/convolution_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 524 | }, |
| 525 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 526 | "common/copy_tensor.cl", |
| 527 | #include "./cl_kernels/common/copy_tensor.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 528 | }, |
| 529 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 530 | "common/crop_tensor.cl", |
| 531 | #include "./cl_kernels/common/crop_tensor.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 532 | }, |
| 533 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 534 | "common/deconvolution_layer.cl", |
| 535 | #include "./cl_kernels/common/deconvolution_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 536 | }, |
| 537 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 538 | "common/cast.cl", |
| 539 | #include "./cl_kernels/common/cast.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 540 | }, |
| 541 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 542 | "common/dequantization_layer.cl", |
| 543 | #include "./cl_kernels/common/dequantization_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 544 | }, |
| 545 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 546 | "common/elementwise_operation.cl", |
| 547 | #include "./cl_kernels/common/elementwise_operation.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 548 | }, |
| 549 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 550 | "common/elementwise_operation_quantized.cl", |
| 551 | #include "./cl_kernels/common/elementwise_operation_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 552 | }, |
| 553 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 554 | "common/elementwise_unary.cl", |
| 555 | #include "./cl_kernels/common/elementwise_unary.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 556 | }, |
| 557 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 558 | "common/fft.cl", |
| 559 | #include "./cl_kernels/common/fft.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 560 | }, |
| 561 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 562 | "common/fft_digit_reverse.cl", |
| 563 | #include "./cl_kernels/common/fft_digit_reverse.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 564 | }, |
| 565 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 566 | "common/fft_scale.cl", |
| 567 | #include "./cl_kernels/common/fft_scale.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 568 | }, |
| 569 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 570 | "common/fill_border.cl", |
| 571 | #include "./cl_kernels/common/fill_border.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 572 | }, |
| 573 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 574 | "common/floor.cl", |
| 575 | #include "./cl_kernels/common/floor.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 576 | }, |
| 577 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 578 | "common/gather.cl", |
| 579 | #include "./cl_kernels/common/gather.clembed" |
| 580 | }, |
| 581 | { |
| 582 | "common/gemm.cl", |
| 583 | #include "./cl_kernels/common/gemm.clembed" |
| 584 | }, |
| 585 | { |
ramelg01 | 9cca592 | 2021-11-11 10:05:00 +0000 | [diff] [blame] | 586 | "common/gemm_utils.cl", |
| 587 | #include "./cl_kernels/common/gemm_utils.clembed" |
| 588 | }, |
| 589 | { |
Giorgio Arena | 892b70a | 2022-03-30 12:23:10 +0100 | [diff] [blame^] | 590 | "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/fp_post_ops_act_eltwise_op_act.h", |
| 591 | #include "./cl_kernels/common/experimental/gemm_fused_post_ops/act_eltwise_op_act/fp_post_ops_act_eltwise_op_act.hembed" |
| 592 | }, |
| 593 | { |
SiCongLi | afa1972 | 2021-10-24 19:12:33 +0100 | [diff] [blame] | 594 | "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_native.cl", |
| 595 | #include "./cl_kernels/common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_native.clembed" |
| 596 | }, |
| 597 | { |
SiCongLi | 1af5416 | 2021-10-06 15:25:57 +0100 | [diff] [blame] | 598 | "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped.cl", |
| 599 | #include "./cl_kernels/common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped.clembed" |
| 600 | }, |
| 601 | { |
Ramy Elgammal | 451c309 | 2022-02-01 23:01:27 +0000 | [diff] [blame] | 602 | "common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped_only_rhs.cl", |
| 603 | #include "./cl_kernels/common/experimental/gemm_fused_post_ops/act_eltwise_op_act/gemm_mm_reshaped_only_rhs.clembed" |
| 604 | }, |
| 605 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 606 | "common/gemmlowp.cl", |
| 607 | #include "./cl_kernels/common/gemmlowp.clembed" |
| 608 | }, |
| 609 | { |
| 610 | "common/gemv.cl", |
| 611 | #include "./cl_kernels/common/gemv.clembed" |
| 612 | }, |
| 613 | { |
| 614 | "common/generate_proposals.cl", |
| 615 | #include "./cl_kernels/common/generate_proposals.clembed" |
| 616 | }, |
| 617 | { |
| 618 | "common/generate_proposals_quantized.cl", |
| 619 | #include "./cl_kernels/common/generate_proposals_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 620 | }, |
| 621 | { |
Giorgio Arena | 892b70a | 2022-03-30 12:23:10 +0100 | [diff] [blame^] | 622 | "gemm_helpers.h", |
| 623 | #include "./cl_kernels/gemm_helpers.hembed" |
| 624 | }, |
| 625 | { |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 626 | "helpers.h", |
| 627 | #include "./cl_kernels/helpers.hembed" |
| 628 | }, |
| 629 | { |
| 630 | "helpers_asymm.h", |
| 631 | #include "./cl_kernels/helpers_asymm.hembed" |
| 632 | }, |
| 633 | { |
Giorgio Arena | 892b70a | 2022-03-30 12:23:10 +0100 | [diff] [blame^] | 634 | "repeat.h", |
| 635 | #include "./cl_kernels/repeat.hembed" |
| 636 | }, |
| 637 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 638 | "common/instance_normalization.cl", |
| 639 | #include "./cl_kernels/common/instance_normalization.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 640 | }, |
| 641 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 642 | "common/l2_normalize.cl", |
| 643 | #include "./cl_kernels/common/l2_normalize.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 644 | }, |
| 645 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 646 | "common/mean_stddev_normalization.cl", |
| 647 | #include "./cl_kernels/common/mean_stddev_normalization.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 648 | }, |
| 649 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 650 | "common/memset.cl", |
| 651 | #include "./cl_kernels/common/memset.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 652 | }, |
| 653 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 654 | "common/minmax_layer.cl", |
| 655 | #include "./cl_kernels/common/minmax_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 656 | }, |
| 657 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 658 | "common/nonmax.cl", |
| 659 | #include "./cl_kernels/common/nonmax.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 660 | }, |
| 661 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 662 | "common/batchnormalization_layer.cl", |
| 663 | #include "./cl_kernels/common/batchnormalization_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 664 | }, |
| 665 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 666 | "common/pad_layer.cl", |
| 667 | #include "./cl_kernels/common/pad_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 668 | }, |
| 669 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 670 | "common/permute.cl", |
| 671 | #include "./cl_kernels/common/permute.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 672 | }, |
| 673 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 674 | "common/pixelwise_mul_float.cl", |
| 675 | #include "./cl_kernels/common/pixelwise_mul_float.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 676 | }, |
| 677 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 678 | "common/pixelwise_mul_int.cl", |
| 679 | #include "./cl_kernels/common/pixelwise_mul_int.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 680 | }, |
| 681 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 682 | "common/qlstm_layer_normalization.cl", |
| 683 | #include "./cl_kernels/common/qlstm_layer_normalization.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 684 | }, |
| 685 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 686 | "common/quantization_layer.cl", |
| 687 | #include "./cl_kernels/common/quantization_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 688 | }, |
| 689 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 690 | "common/range.cl", |
| 691 | #include "./cl_kernels/common/range.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 692 | }, |
| 693 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 694 | "common/reduction_operation.cl", |
| 695 | #include "./cl_kernels/common/reduction_operation.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 696 | }, |
| 697 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 698 | "common/reshape_layer.cl", |
| 699 | #include "./cl_kernels/common/reshape_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 700 | }, |
| 701 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 702 | "common/reverse.cl", |
| 703 | #include "./cl_kernels/common/reverse.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 704 | }, |
| 705 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 706 | "common/roi_align_layer.cl", |
| 707 | #include "./cl_kernels/common/roi_align_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 708 | }, |
| 709 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 710 | "common/roi_align_layer_quantized.cl", |
| 711 | #include "./cl_kernels/common/roi_align_layer_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 712 | }, |
| 713 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 714 | "common/roi_pooling_layer.cl", |
| 715 | #include "./cl_kernels/common/roi_pooling_layer.clembed" |
| 716 | }, |
| 717 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 718 | "common/select.cl", |
| 719 | #include "./cl_kernels/common/select.clembed" |
| 720 | }, |
| 721 | { |
| 722 | "common/softmax_layer.cl", |
| 723 | #include "./cl_kernels/common/softmax_layer.clembed" |
| 724 | }, |
| 725 | { |
| 726 | "common/softmax_layer_quantized.cl", |
| 727 | #include "./cl_kernels/common/softmax_layer_quantized.clembed" |
| 728 | }, |
| 729 | { |
| 730 | "common/slice_ops.cl", |
| 731 | #include "./cl_kernels/common/slice_ops.clembed" |
| 732 | }, |
| 733 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 734 | "common/stack_layer.cl", |
| 735 | #include "./cl_kernels/common/stack_layer.clembed" |
| 736 | }, |
| 737 | { |
| 738 | "common/tile.cl", |
| 739 | #include "./cl_kernels/common/tile.clembed" |
| 740 | }, |
| 741 | { |
| 742 | "common/transpose.cl", |
| 743 | #include "./cl_kernels/common/transpose.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 744 | }, |
| 745 | { |
| 746 | "types.h", |
| 747 | #include "./cl_kernels/types.hembed" |
| 748 | }, |
| 749 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 750 | "common/unpooling_layer.cl", |
| 751 | #include "./cl_kernels/common/unpooling_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 752 | }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 753 | #ifdef ENABLE_NCHW_KERNELS |
| 754 | { |
| 755 | "nchw/batch_to_space.cl", |
| 756 | #include "./cl_kernels/nchw/batch_to_space.clembed" |
| 757 | }, |
| 758 | { |
| 759 | "nchw/channel_shuffle.cl", |
| 760 | #include "./cl_kernels/nchw/channel_shuffle.clembed" |
| 761 | }, |
| 762 | { |
| 763 | "nchw/upsample_layer.cl", |
| 764 | #include "./cl_kernels/nchw/upsample_layer.clembed" |
| 765 | }, |
| 766 | { |
| 767 | "nchw/depth_to_space.cl", |
| 768 | #include "./cl_kernels/nchw/depth_to_space.clembed" |
| 769 | }, |
| 770 | { |
| 771 | "nchw/dequantization_layer.cl", |
| 772 | #include "./cl_kernels/nchw/dequantization_layer.clembed" |
| 773 | }, |
| 774 | { |
Adnan AlSinan | 3012435 | 2021-12-02 19:12:20 +0000 | [diff] [blame] | 775 | "nchw/direct_convolution.cl", |
| 776 | #include "./cl_kernels/nchw/direct_convolution.clembed" |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 777 | }, |
| 778 | { |
| 779 | "nchw/im2col.cl", |
| 780 | #include "./cl_kernels/nchw/im2col.clembed" |
| 781 | }, |
| 782 | { |
| 783 | "nchw/normalization_layer.cl", |
| 784 | #include "./cl_kernels/nchw/normalization_layer.clembed" |
| 785 | }, |
| 786 | { |
| 787 | "nchw/normalize_planar_yuv_layer.cl", |
| 788 | #include "./cl_kernels/nchw/normalize_planar_yuv_layer.clembed" |
| 789 | }, |
| 790 | { |
| 791 | "nchw/normalize_planar_yuv_layer_quantized.cl", |
| 792 | #include "./cl_kernels/nchw/normalize_planar_yuv_layer_quantized.clembed" |
| 793 | }, |
| 794 | { |
| 795 | "nchw/batchnormalization_layer.cl", |
| 796 | #include "./cl_kernels/nchw/batchnormalization_layer.clembed" |
| 797 | }, |
| 798 | { |
| 799 | "nchw/pooling_layer.cl", |
| 800 | #include "./cl_kernels/nchw/pooling_layer.clembed" |
| 801 | }, |
| 802 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 803 | "nchw/prior_box_layer.cl", |
| 804 | #include "./cl_kernels/nchw/prior_box_layer.clembed" |
| 805 | }, |
| 806 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 807 | "nchw/reorg_layer.cl", |
| 808 | #include "./cl_kernels/nchw/reorg_layer.clembed" |
| 809 | }, |
| 810 | { |
| 811 | "nchw/scale.cl", |
| 812 | #include "./cl_kernels/nchw/scale.clembed" |
| 813 | }, |
| 814 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 815 | "nchw/space_to_batch.cl", |
| 816 | #include "./cl_kernels/nchw/space_to_batch.clembed" |
| 817 | }, |
| 818 | { |
| 819 | "nchw/space_to_depth.cl", |
| 820 | #include "./cl_kernels/nchw/space_to_depth.clembed" |
| 821 | }, |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 822 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 823 | "nchw/winograd_filter_transform.cl", |
| 824 | #include "./cl_kernels/nchw/winograd_filter_transform.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 825 | }, |
| 826 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 827 | "nchw/winograd_input_transform.cl", |
| 828 | #include "./cl_kernels/nchw/winograd_input_transform.clembed" |
| 829 | }, |
| 830 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 831 | "nchw/winograd_output_transform.cl", |
| 832 | #include "./cl_kernels/nchw/winograd_output_transform.clembed" |
| 833 | }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 834 | #endif /* ENABLE_NCHW_KERNELS */ |
| 835 | |
| 836 | #ifdef ENABLE_NHWC_KERNELS |
| 837 | { |
| 838 | "nhwc/batch_to_space.cl", |
| 839 | #include "./cl_kernels/nhwc/batch_to_space.clembed" |
| 840 | }, |
| 841 | { |
| 842 | "nhwc/channel_shuffle.cl", |
| 843 | #include "./cl_kernels/nhwc/channel_shuffle.clembed" |
| 844 | }, |
| 845 | { |
| 846 | "nhwc/upsample_layer.cl", |
| 847 | #include "./cl_kernels/nhwc/upsample_layer.clembed" |
| 848 | }, |
| 849 | { |
| 850 | "nhwc/depth_to_space.cl", |
| 851 | #include "./cl_kernels/nhwc/depth_to_space.clembed" |
| 852 | }, |
| 853 | { |
| 854 | "nhwc/dequantization_layer.cl", |
| 855 | #include "./cl_kernels/nhwc/dequantization_layer.clembed" |
| 856 | }, |
| 857 | { |
| 858 | "nhwc/direct_convolution.cl", |
| 859 | #include "./cl_kernels/nhwc/direct_convolution.clembed" |
| 860 | }, |
| 861 | { |
Giorgio Arena | 945ae9e | 2021-10-13 11:13:04 +0100 | [diff] [blame] | 862 | "nhwc/direct_convolution3d.cl", |
| 863 | #include "./cl_kernels/nhwc/direct_convolution3d.clembed" |
| 864 | }, |
| 865 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 866 | "nhwc/dwc_native_fp_nhwc.cl", |
| 867 | #include "./cl_kernels/nhwc/dwc_native_fp_nhwc.clembed" |
| 868 | }, |
| 869 | { |
| 870 | "nhwc/dwc_native_quantized_nhwc.cl", |
| 871 | #include "./cl_kernels/nhwc/dwc_native_quantized_nhwc.clembed" |
| 872 | }, |
| 873 | { |
| 874 | "nhwc/normalization_layer.cl", |
| 875 | #include "./cl_kernels/nhwc/normalization_layer.clembed" |
| 876 | }, |
| 877 | { |
| 878 | "nhwc/normalize_planar_yuv_layer.cl", |
| 879 | #include "./cl_kernels/nhwc/normalize_planar_yuv_layer.clembed" |
| 880 | }, |
| 881 | { |
| 882 | "nhwc/normalize_planar_yuv_layer_quantized.cl", |
| 883 | #include "./cl_kernels/nhwc/normalize_planar_yuv_layer_quantized.clembed" |
| 884 | }, |
| 885 | { |
| 886 | "nhwc/im2col.cl", |
| 887 | #include "./cl_kernels/nhwc/im2col.clembed" |
| 888 | }, |
| 889 | { |
| 890 | "nhwc/batchnormalization_layer.cl", |
| 891 | #include "./cl_kernels/nhwc/batchnormalization_layer.clembed" |
| 892 | }, |
| 893 | { |
| 894 | "nhwc/pooling_layer.cl", |
| 895 | #include "./cl_kernels/nhwc/pooling_layer.clembed" |
| 896 | }, |
| 897 | { |
ramelg01 | 3751569 | 2022-02-26 22:06:20 +0000 | [diff] [blame] | 898 | "nhwc/pooling_3d_layer.cl", |
| 899 | #include "./cl_kernels/nhwc/pooling_3d_layer.clembed" |
| 900 | }, |
| 901 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 902 | "nhwc/pooling_layer_quantized.cl", |
| 903 | #include "./cl_kernels/nhwc/pooling_layer_quantized.clembed" |
| 904 | }, |
| 905 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 906 | "nhwc/reorg_layer.cl", |
| 907 | #include "./cl_kernels/nhwc/reorg_layer.clembed" |
| 908 | }, |
| 909 | { |
| 910 | "nhwc/scale.cl", |
| 911 | #include "./cl_kernels/nhwc/scale.clembed" |
| 912 | }, |
| 913 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 914 | "nhwc/space_to_batch.cl", |
| 915 | #include "./cl_kernels/nhwc/space_to_batch.clembed" |
| 916 | }, |
| 917 | { |
| 918 | "nhwc/space_to_depth.cl", |
| 919 | #include "./cl_kernels/nhwc/space_to_depth.clembed" |
| 920 | }, |
| 921 | { |
| 922 | "nhwc/winograd_filter_transform.cl", |
| 923 | #include "./cl_kernels/nhwc/winograd_filter_transform.clembed" |
| 924 | }, |
| 925 | { |
| 926 | "nhwc/winograd_input_transform.cl", |
| 927 | #include "./cl_kernels/nhwc/winograd_input_transform.clembed" |
| 928 | }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 929 | { |
| 930 | "nhwc/winograd_output_transform.cl", |
| 931 | #include "./cl_kernels/nhwc/winograd_output_transform.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 932 | }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 933 | #endif /* ENABLE_NHWC_KERNELS */ |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 934 | #endif /* EMBEDDED_KERNELS */ |
| 935 | }; |
| 936 | |
| 937 | ClKernelLibrary &ClKernelLibrary::get() |
| 938 | { |
| 939 | static ClKernelLibrary _kernel_library; |
| 940 | return _kernel_library; |
| 941 | } |
| 942 | |
| 943 | std::string ClKernelLibrary::program_name(const std::string &kernel_name) const |
| 944 | { |
| 945 | // Find which program contains the kernel |
| 946 | auto kernel_program_it = _kernel_program_map.find(kernel_name); |
| 947 | |
| 948 | if(_kernel_program_map.end() == kernel_program_it) |
| 949 | { |
| 950 | ARM_COMPUTE_ERROR_VAR("Kernel %s not found in the CLKernelLibrary", kernel_name.c_str()); |
| 951 | } |
| 952 | |
| 953 | const std::string program_name = kernel_program_it->second; |
| 954 | |
| 955 | return program_name; |
| 956 | } |
| 957 | |
| 958 | void ClKernelLibrary::set_kernel_path(std::string kernel_path) |
| 959 | { |
| 960 | _kernel_path = std::move(kernel_path); |
| 961 | _kernel_path += "/"; |
| 962 | } |
| 963 | |
| 964 | const std::string &ClKernelLibrary::kernel_path() const |
| 965 | { |
| 966 | return _kernel_path; |
| 967 | } |
| 968 | |
| 969 | ClKernelLibrary::ClProgramInfo ClKernelLibrary::program(const std::string &program_name) const |
| 970 | { |
| 971 | #ifdef EMBEDDED_KERNELS |
| 972 | #ifdef ARM_COMPUTE_COMPRESSED_KERNELS |
| 973 | const auto inflatted_program_source_it = _decompressed_source_map.find(program_name); |
| 974 | if(inflatted_program_source_it != _decompressed_source_map.end()) |
| 975 | { |
| 976 | return ClProgramInfo{ inflatted_program_source_it->second, false }; |
| 977 | } |
| 978 | #endif /* ARM_COMPUTE_COMPRESSED_KERNELS */ |
| 979 | |
| 980 | const auto program_source_it = _program_source_map.find(program_name); |
| 981 | if(program_source_it == _program_source_map.end()) |
| 982 | { |
| 983 | ARM_COMPUTE_ERROR_VAR("Embedded program for %s does not exist.", program_name.c_str()); |
| 984 | } |
| 985 | std::string program_source = program_source_it->second; |
| 986 | |
| 987 | #ifdef ARM_COMPUTE_COMPRESSED_KERNELS |
| 988 | std::string decompressed_program_source = decompress_zlib(decode_base64(program_source_it->second)); |
| 989 | ARM_COMPUTE_ERROR_ON_MSG(decompressed_program_source.empty(), "Cannot de-compress requested program"); |
| 990 | _decompressed_source_map.insert(std::make_pair(program_name, decompressed_program_source)); |
| 991 | program_source = std::move(decompressed_program_source); |
| 992 | #endif /* ARM_COMPUTE_COMPRESSED_KERNELS */ |
| 993 | |
| 994 | return ClProgramInfo{ program_source, false }; |
| 995 | #else /* EMBEDDED_KERNELS */ |
| 996 | // Check for binary |
| 997 | std::string source_name = _kernel_path + program_name; |
| 998 | std::string binary_name = source_name + "bin"; |
| 999 | std::string program_source{}; |
| 1000 | bool is_binary = false; |
| 1001 | |
| 1002 | if(std::ifstream(binary_name).is_open()) |
| 1003 | { |
| 1004 | program_source = read_file(binary_name, true); |
| 1005 | is_binary = true; |
| 1006 | } |
| 1007 | else if(std::ifstream(source_name).is_open()) |
| 1008 | { |
| 1009 | program_source = read_file(source_name, false); |
| 1010 | } |
| 1011 | else |
| 1012 | { |
| 1013 | ARM_COMPUTE_ERROR_VAR("Kernel file %s does not exist.", source_name.c_str()); |
| 1014 | } |
| 1015 | |
| 1016 | return ClProgramInfo{ program_source, is_binary }; |
| 1017 | #endif /* EMBEDDED_KERNELS */ |
| 1018 | } |
| 1019 | } // namespace opencl |
| 1020 | } // namespace arm_compute |