Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 1 | /* |
Ramy Elgammal | 2b6ebfe | 2023-03-09 21:15:37 +0000 | [diff] [blame] | 2 | * Copyright (c) 2016-2023 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" }, |
Ramy Elgammal | 14d7b53 | 2023-01-30 04:56:47 +0000 | [diff] [blame] | 238 | { "elementwise_unary_quantized", "common/elementwise_unary_quantized.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 239 | { "fft_digit_reverse_axis_0", "common/fft_digit_reverse.cl" }, |
| 240 | { "fft_digit_reverse_axis_1", "common/fft_digit_reverse.cl" }, |
| 241 | { "fft_radix_2_first_stage_axis_0", "common/fft.cl" }, |
| 242 | { "fft_radix_2_first_stage_axis_1", "common/fft.cl" }, |
| 243 | { "fft_radix_2_axis_0", "common/fft.cl" }, |
| 244 | { "fft_radix_2_axis_1", "common/fft.cl" }, |
| 245 | { "fft_radix_3_first_stage_axis_0", "common/fft.cl" }, |
| 246 | { "fft_radix_3_first_stage_axis_1", "common/fft.cl" }, |
| 247 | { "fft_radix_3_axis_0", "common/fft.cl" }, |
| 248 | { "fft_radix_3_axis_1", "common/fft.cl" }, |
| 249 | { "fft_radix_4_first_stage_axis_0", "common/fft.cl" }, |
| 250 | { "fft_radix_4_first_stage_axis_1", "common/fft.cl" }, |
| 251 | { "fft_radix_4_axis_0", "common/fft.cl" }, |
| 252 | { "fft_radix_4_axis_1", "common/fft.cl" }, |
| 253 | { "fft_radix_5_first_stage_axis_0", "common/fft.cl" }, |
| 254 | { "fft_radix_5_first_stage_axis_1", "common/fft.cl" }, |
| 255 | { "fft_radix_5_axis_0", "common/fft.cl" }, |
| 256 | { "fft_radix_5_axis_1", "common/fft.cl" }, |
| 257 | { "fft_radix_7_first_stage_axis_0", "common/fft.cl" }, |
| 258 | { "fft_radix_7_first_stage_axis_1", "common/fft.cl" }, |
| 259 | { "fft_radix_7_axis_0", "common/fft.cl" }, |
| 260 | { "fft_radix_7_axis_1", "common/fft.cl" }, |
| 261 | { "fft_radix_8_first_stage_axis_0", "common/fft.cl" }, |
| 262 | { "fft_radix_8_first_stage_axis_1", "common/fft.cl" }, |
| 263 | { "fft_radix_8_axis_0", "common/fft.cl" }, |
| 264 | { "fft_radix_8_axis_1", "common/fft.cl" }, |
| 265 | { "fft_scale_conj", "common/fft_scale.cl" }, |
| 266 | { "fill_image_borders_constant", "common/fill_border.cl" }, |
| 267 | { "fill_image_borders_replicate", "common/fill_border.cl" }, |
| 268 | { "floor_layer", "common/floor.cl" }, |
| 269 | { "fuse_batchnormalization_layer", "common/batchnormalization_layer.cl" }, |
| 270 | { "gather", "common/gather.cl" }, |
| 271 | { "gemm_ma_f16", "common/gemm.cl" }, |
| 272 | { "gemm_ma_f32", "common/gemm.cl" }, |
| 273 | { "gemm_mv", "common/gemv.cl" }, |
| 274 | { "gemm_mv_quantized", "common/gemv.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 275 | { "gemm_mm_native", "common/gemm.cl" }, |
Gunes Bayir | 4bfc70e | 2021-12-10 16:17:56 +0000 | [diff] [blame] | 276 | { "gemm_mm_reshaped_only_rhs_nt_mmul", "common/gemm_reshaped_only_rhs_mmul.cl" }, |
| 277 | { "gemm_mm_reshaped_only_rhs_nt_mmul_texture", "common/gemm_reshaped_only_rhs_mmul.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 278 | { "gemm_mm_reshaped_lhs_nt_rhs_t", "common/gemm.cl" }, |
| 279 | { "gemm_mm_reshaped_lhs_nt_rhs_t_texture", "common/gemm.cl" }, |
| 280 | { "gemm_mm_reshaped_lhs_t_rhs_nt", "common/gemm.cl" }, |
| 281 | { "gemm_mm_reshaped_lhs_t_rhs_nt_texture", "common/gemm.cl" }, |
Ramy Elgammal | 451c309 | 2022-02-01 23:01:27 +0000 | [diff] [blame] | 282 | { "gemm_mm_reshaped_only_rhs_nt", "common/gemm.cl" }, |
| 283 | { "gemm_mm_reshaped_only_rhs_nt_texture", "common/gemm.cl" }, |
| 284 | { "gemm_mm_reshaped_only_rhs_t", "common/gemm.cl" }, |
| 285 | { "gemm_mm_reshaped_only_rhs_t_texture", "common/gemm.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 286 | { "gemm_lc_vm_f32", "common/gemm.cl" }, |
ramelg01 | 9cca592 | 2021-11-11 10:05:00 +0000 | [diff] [blame] | 287 | { "gemm_reshape_lhs_matrix_nt", "common/gemm_utils.cl" }, |
| 288 | { "gemm_reshape_lhs_matrix_t", "common/gemm_utils.cl" }, |
| 289 | { "gemm_reshape_rhs_matrix_nt", "common/gemm_utils.cl" }, |
| 290 | { "gemm_reshape_rhs_matrix_t", "common/gemm_utils.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 291 | { "gemmlowp_matrix_a_reduction", "common/gemmlowp.cl" }, |
| 292 | { "gemmlowp_matrix_a_reduction_dot8", "common/gemmlowp.cl" }, |
| 293 | { "gemmlowp_matrix_b_reduction", "common/gemmlowp.cl" }, |
| 294 | { "gemmlowp_mm_native", "common/gemmlowp.cl" }, |
| 295 | { "gemmlowp_mm_reshaped_lhs_nt_rhs_t", "common/gemmlowp.cl" }, |
| 296 | { "gemmlowp_mm_reshaped_only_rhs_t", "common/gemmlowp.cl" }, |
| 297 | { "gemmlowp_mm_reshaped_only_rhs_t_fused_output_stage_fixedpoint", "common/gemmlowp.cl" }, |
Freddie Liardet | e572dff | 2022-05-16 14:09:10 +0100 | [diff] [blame] | 298 | { "gemmlowp_mm_reshaped_only_rhs_mmul", "common/gemmlowp_reshaped_only_rhs_mmul.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 299 | { "gemmlowp_offset_contribution", "common/gemmlowp.cl" }, |
| 300 | { "gemmlowp_offset_contribution_quantize_down", "common/gemmlowp.cl" }, |
| 301 | { "gemmlowp_offset_contribution_quantize_down_fixedpoint", "common/gemmlowp.cl" }, |
| 302 | { "gemmlowp_output_stage_quantize_down", "common/gemmlowp.cl" }, |
| 303 | { "gemmlowp_output_stage_quantize_down_fixedpoint", "common/gemmlowp.cl" }, |
| 304 | { "gemmlowp_output_stage_quantize_down_fixedpoint_qsymm16", "common/gemmlowp.cl" }, |
| 305 | { "gemmlowp_output_stage_quantize_down_float", "common/gemmlowp.cl" }, |
| 306 | { "generate_proposals_compute_all_anchors", "common/generate_proposals.cl" }, |
| 307 | { "generate_proposals_compute_all_anchors_quantized", "common/generate_proposals_quantized.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 308 | { "instance_normalization", "common/instance_normalization.cl" }, |
| 309 | { "compute_mean_var", "common/instance_normalization.cl" }, |
| 310 | { "l2_normalize_x", "common/l2_normalize.cl" }, |
| 311 | { "l2_normalize_y", "common/l2_normalize.cl" }, |
| 312 | { "l2_normalize_z", "common/l2_normalize.cl" }, |
SiCong Li | a8d8058 | 2023-05-19 14:23:37 +0100 | [diff] [blame] | 313 | { "mat_mul_native_mmul_nt_nt", "common/mat_mul_mmul.cl" }, |
Gunes Bayir | 00474e9 | 2023-06-19 21:33:51 +0100 | [diff] [blame] | 314 | { "mat_mul_native_mmul_t_nt", "common/mat_mul_mmul.cl" }, |
Ramy Elgammal | c952596 | 2023-05-19 14:23:37 +0100 | [diff] [blame] | 315 | { "mat_mul_native_mmul_nt_t", "common/mat_mul_mmul.cl" }, |
Gunes Bayir | 00474e9 | 2023-06-19 21:33:51 +0100 | [diff] [blame] | 316 | { "mat_mul_native_mmul_t_t", "common/mat_mul_mmul.cl" }, |
Gunes Bayir | 8918b23 | 2023-03-17 13:52:21 +0000 | [diff] [blame] | 317 | { "mat_mul_native_nt_nt", "common/mat_mul.cl" }, |
| 318 | { "mat_mul_native_nt_t", "common/mat_mul.cl" }, |
| 319 | { "mat_mul_native_t_nt", "common/mat_mul.cl" }, |
| 320 | { "mat_mul_native_t_t", "common/mat_mul.cl" }, |
Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 321 | { "mat_mul_native_quantized_nt_nt", "common/mat_mul_quantized.cl" }, |
Jakub Sujak | 5e99a3e | 2023-04-18 08:33:56 +0100 | [diff] [blame] | 322 | { "mat_mul_native_quantized_nt_t", "common/mat_mul_quantized.cl" }, |
Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 323 | { "mat_mul_native_quantized_t_nt", "common/mat_mul_quantized.cl" }, |
Omar Al Khatib | 467daef | 2023-04-13 14:56:23 +0100 | [diff] [blame] | 324 | { "mat_mul_native_quantized_t_t", "common/mat_mul_quantized.cl" }, |
Gunes Bayir | e87fa66 | 2023-09-07 12:20:33 +0100 | [diff] [blame] | 325 | { "mat_mul_native_quantized_mmul_nt_nt", "common/mat_mul_quantized_mmul.cl" }, |
| 326 | { "mat_mul_native_quantized_mmul_nt_t", "common/mat_mul_quantized_mmul.cl" }, |
| 327 | { "mat_mul_native_quantized_mmul_t_nt", "common/mat_mul_quantized_mmul.cl" }, |
| 328 | { "mat_mul_native_quantized_mmul_t_t", "common/mat_mul_quantized_mmul.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 329 | { "max_unpooling_layer_2", "common/unpooling_layer.cl" }, |
| 330 | { "mean_stddev_normalization", "common/mean_stddev_normalization.cl" }, |
| 331 | { "memset", "common/memset.cl" }, |
| 332 | { "minmax_layer", "common/minmax_layer.cl" }, |
| 333 | { "non_max_suppression", "common/nonmax.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 334 | { "pad_layer_constant", "common/pad_layer.cl" }, |
| 335 | { "pad_layer_symmetric_reflect", "common/pad_layer.cl" }, |
| 336 | { "permute", "common/permute.cl" }, |
| 337 | { "pixelwise_mul_complex", "common/pixelwise_mul_float.cl" }, |
| 338 | { "pixelwise_mul_float", "common/pixelwise_mul_float.cl" }, |
| 339 | { "pixelwise_mul_int", "common/pixelwise_mul_int.cl" }, |
| 340 | { "pixelwise_mul_quantized", "common/pixelwise_mul_int.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 341 | { "qlstm_layer_normalization", "common/qlstm_layer_normalization.cl" }, |
| 342 | { "quantization_layer", "common/quantization_layer.cl" }, |
| 343 | { "range", "common/range.cl" }, |
| 344 | { "range_quantized", "common/range.cl" }, |
| 345 | { "reduction_operation_x", "common/reduction_operation.cl" }, |
| 346 | { "reduction_operation_non_parallel_x", "common/reduction_operation.cl" }, |
| 347 | { "reduction_operation_y", "common/reduction_operation.cl" }, |
| 348 | { "reduction_operation_z", "common/reduction_operation.cl" }, |
| 349 | { "reduction_operation_w", "common/reduction_operation.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 350 | { "reshape_layer", "common/reshape_layer.cl" }, |
| 351 | { "reshape_to_columns", "common/convolution_layer.cl" }, |
| 352 | { "reverse", "common/reverse.cl" }, |
| 353 | { "roi_align_layer", "common/roi_align_layer.cl" }, |
| 354 | { "roi_align_layer_quantized", "common/roi_align_layer_quantized.cl" }, |
| 355 | { "roi_pooling_layer", "common/roi_pooling_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 356 | { "select_same_rank", "common/select.cl" }, |
| 357 | { "select_different_rank_2", "common/select.cl" }, |
| 358 | { "select_different_rank_n", "common/select.cl" }, |
| 359 | { "softmax_layer_norm", "common/softmax_layer.cl" }, |
| 360 | { "softmax_layer_norm_quantized", "common/softmax_layer_quantized.cl" }, |
| 361 | { "softmax_layer_max_shift_exp_sum_quantized_serial", "common/softmax_layer_quantized.cl" }, |
| 362 | { "softmax_layer_max_shift_exp_sum_quantized_parallel", "common/softmax_layer_quantized.cl" }, |
| 363 | { "softmax_layer_max_shift_exp_sum_serial", "common/softmax_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 364 | { "softmax_layer_max_shift_exp_sum_parallel", "common/softmax_layer.cl" }, |
| 365 | { "stack_layer", "common/stack_layer.cl" }, |
| 366 | { "strided_slice", "common/slice_ops.cl" }, |
| 367 | { "tile", "common/tile.cl" }, |
| 368 | { "transpose", "common/transpose.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 369 | #ifdef ENABLE_NCHW_KERNELS |
| 370 | { "batch_to_space_nchw", "nchw/batch_to_space.cl" }, |
| 371 | { "batch_to_space_static_nchw", "nchw/batch_to_space.cl" }, |
| 372 | { "batchnormalization_layer_nchw", "nchw/batchnormalization_layer.cl" }, |
| 373 | { "channel_shuffle_nchw", "nchw/channel_shuffle.cl" }, |
| 374 | { "depth_to_space_nchw", "nchw/depth_to_space.cl" }, |
| 375 | { "dequantization_layer_per_channel_nchw", "nchw/dequantization_layer.cl" }, |
| 376 | { "direct_convolution1x1", "nchw/direct_convolution1x1.cl" }, |
Adnan AlSinan | 3012435 | 2021-12-02 19:12:20 +0000 | [diff] [blame] | 377 | { "direct_convolution_nchw", "nchw/direct_convolution.cl" }, |
| 378 | |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 379 | { "im2col1x1_stridex1_nchw", "nchw/im2col.cl" }, |
| 380 | { "im2col3x3_nchw", "nchw/im2col.cl" }, |
| 381 | { "im2col5x5_nchw", "nchw/im2col.cl" }, |
| 382 | { "im2col11x11_padx0_pady0_nchw", "nchw/im2col.cl" }, |
| 383 | { "im2col_generic_nchw", "nchw/im2col.cl" }, |
| 384 | { "im2col_generic_padx0_pady0_nchw", "nchw/im2col.cl" }, |
| 385 | { "normalization_layer_cross_map_nchw", "nchw/normalization_layer.cl" }, |
| 386 | { "normalization_layer_in_map_nchw", "nchw/normalization_layer.cl" }, |
| 387 | { "normalize_planar_yuv_layer_nchw", "nchw/normalize_planar_yuv_layer.cl" }, |
| 388 | { "normalize_planar_yuv_layer_q8_nchw", "nchw/normalize_planar_yuv_layer_quantized.cl" }, |
| 389 | { "pooling_layer_MxN_nchw", "nchw/pooling_layer.cl" }, |
Giorgio Arena | 8fce496 | 2021-09-01 14:05:00 +0100 | [diff] [blame] | 390 | { "pooling_layer_2_nchw_indices", "nchw/pooling_layer.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 391 | { "prior_box_layer_nchw", "nchw/prior_box_layer.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 392 | { "reorg_layer_nchw", "nchw/reorg_layer.cl" }, |
| 393 | { "scale_nearest_neighbour_nchw", "nchw/scale.cl" }, |
| 394 | { "scale_bilinear_nchw", "nchw/scale.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 395 | { "space_to_batch_nchw", "nchw/space_to_batch.cl" }, |
| 396 | { "space_to_batch_static_nchw", "nchw/space_to_batch.cl" }, |
| 397 | { "space_to_depth_nchw", "nchw/space_to_depth.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 398 | { "upsample_layer_nchw", "nchw/upsample_layer.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 399 | { "winograd_filter_transform_2x2_3x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 400 | { "winograd_filter_transform_2x1_3x1_nchw", "nchw/winograd_filter_transform.cl" }, |
| 401 | { "winograd_filter_transform_1x2_1x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 402 | { "winograd_filter_transform_4x4_3x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 403 | { "winograd_filter_transform_4x1_3x1_nchw", "nchw/winograd_filter_transform.cl" }, |
| 404 | { "winograd_filter_transform_1x4_1x3_nchw", "nchw/winograd_filter_transform.cl" }, |
| 405 | { "winograd_filter_transform_4x4_5x5_nchw", "nchw/winograd_filter_transform.cl" }, |
| 406 | { "winograd_filter_transform_4x1_5x1_nchw", "nchw/winograd_filter_transform.cl" }, |
| 407 | { "winograd_filter_transform_1x4_1x5_nchw", "nchw/winograd_filter_transform.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 408 | { "winograd_input_transform_2x2_3x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 409 | { "winograd_input_transform_2x2_3x3_stepz2_nchw", "nchw/winograd_input_transform.cl" }, |
| 410 | { "winograd_input_transform_2x1_3x1_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 411 | { "winograd_input_transform_2x1_3x1_stepz2_nchw", "nchw/winograd_input_transform.cl" }, |
| 412 | { "winograd_input_transform_1x2_1x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 413 | { "winograd_input_transform_1x2_1x3_stepz2_nchw", "nchw/winograd_input_transform.cl" }, |
| 414 | { "winograd_input_transform_4x4_3x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 415 | { "winograd_input_transform_4x1_3x1_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 416 | { "winograd_input_transform_1x4_1x3_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 417 | { "winograd_input_transform_4x4_5x5_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 418 | { "winograd_input_transform_4x1_5x1_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
| 419 | { "winograd_input_transform_1x4_1x5_stepz1_nchw", "nchw/winograd_input_transform.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 420 | { "winograd_output_transform_2x2_3x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 421 | { "winograd_output_transform_2x1_3x1_nchw", "nchw/winograd_output_transform.cl" }, |
| 422 | { "winograd_output_transform_1x2_1x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 423 | { "winograd_output_transform_4x4_3x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 424 | { "winograd_output_transform_4x1_3x1_nchw", "nchw/winograd_output_transform.cl" }, |
| 425 | { "winograd_output_transform_1x4_1x3_nchw", "nchw/winograd_output_transform.cl" }, |
| 426 | { "winograd_output_transform_4x4_5x5_nchw", "nchw/winograd_output_transform.cl" }, |
| 427 | { "winograd_output_transform_4x1_5x1_nchw", "nchw/winograd_output_transform.cl" }, |
| 428 | { "winograd_output_transform_1x4_1x5_nchw", "nchw/winograd_output_transform.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 429 | #endif /* ENABLE_NCHW_KERNELS */ |
| 430 | #ifdef ENABLE_NHWC_KERNELS |
| 431 | { "batch_to_space_nhwc", "nhwc/batch_to_space.cl" }, |
| 432 | { "batch_to_space_static_nhwc", "nhwc/batch_to_space.cl" }, |
| 433 | { "batchnormalization_layer_nhwc", "nhwc/batchnormalization_layer.cl" }, |
| 434 | { "channel_shuffle_nhwc", "nhwc/channel_shuffle.cl" }, |
| 435 | { "depth_to_space_nhwc", "nhwc/depth_to_space.cl" }, |
| 436 | { "dequantization_layer_per_channel_nhwc", "nhwc/dequantization_layer.cl" }, |
| 437 | { "dwc_native_fp_nhwc", "nhwc/dwc_native_fp_nhwc.cl" }, |
| 438 | { "dwc_native_quantized_nhwc", "nhwc/dwc_native_quantized_nhwc.cl" }, |
| 439 | { "direct_convolution_nhwc", "nhwc/direct_convolution.cl" }, |
Giorgio Arena | 945ae9e | 2021-10-13 11:13:04 +0100 | [diff] [blame] | 440 | { "direct_convolution3d_ndhwc", "nhwc/direct_convolution3d.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 441 | { "im2col3x3_nhwc", "nhwc/im2col.cl" }, |
| 442 | { "im2col9x9_nhwc", "nhwc/im2col.cl" }, |
| 443 | { "im2col_generic_nhwc", "nhwc/im2col.cl" }, |
Gian Marco Iodice | 76335eb | 2022-11-17 11:03:39 +0000 | [diff] [blame] | 444 | { "indirect_convolution_nhwc", "nhwc/indirect_convolution.cl" }, |
Gian Marco Iodice | 5d01681 | 2022-11-17 11:03:39 +0000 | [diff] [blame] | 445 | { "indirect_convolution_address_precalculation", "nhwc/indirect_convolution.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 446 | { "normalization_layer_cross_map_nhwc", "nhwc/normalization_layer.cl" }, |
| 447 | { "normalization_layer_in_map_nhwc", "nhwc/normalization_layer.cl" }, |
| 448 | { "normalize_planar_yuv_layer_nhwc", "nhwc/normalize_planar_yuv_layer.cl" }, |
| 449 | { "normalize_planar_yuv_layer_q8_nhwc", "nhwc/normalize_planar_yuv_layer_quantized.cl" }, |
| 450 | { "pooling_layer_MxN_nhwc", "nhwc/pooling_layer.cl" }, |
| 451 | { "pooling_layer_2x2_nhwc", "nhwc/pooling_layer.cl" }, |
| 452 | { "pooling_layer_MxN_quantized_nhwc", "nhwc/pooling_layer_quantized.cl" }, |
ramelg01 | 3751569 | 2022-02-26 22:06:20 +0000 | [diff] [blame] | 453 | { "pooling_3d_layer_MxN_ndhwc", "nhwc/pooling_3d_layer.cl" }, |
Mohammed Suhail Munshi | 5e549fa | 2022-03-16 11:14:06 +0000 | [diff] [blame] | 454 | { "pooling_3d_layer_MxN_ndhwc_quantized", "nhwc/pooling_3d_layer_quantized.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 455 | { "reorg_layer_nhwc", "nhwc/reorg_layer.cl" }, |
| 456 | { "scale_nearest_neighbour_nhwc", "nhwc/scale.cl" }, |
| 457 | { "scale_bilinear_nhwc", "nhwc/scale.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 458 | { "space_to_batch_nhwc", "nhwc/space_to_batch.cl" }, |
| 459 | { "space_to_batch_static_nhwc", "nhwc/space_to_batch.cl" }, |
| 460 | { "space_to_depth_nhwc", "nhwc/space_to_depth.cl" }, |
Gunes Bayir | ec0113d | 2022-11-09 09:26:27 +0000 | [diff] [blame] | 461 | { "transposed_convolution_nhwc", "nhwc/transposed_convolution.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 462 | { "upsample_layer_nhwc", "nhwc/upsample_layer.cl" }, |
| 463 | { "winograd_filter_transform_4x1_3x1_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 464 | { "winograd_filter_transform_1x4_1x3_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 465 | { "winograd_filter_transform_4x4_3x3_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 466 | { "winograd_filter_transform_4x4_5x5_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 467 | { "winograd_filter_transform_4x1_5x1_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 468 | { "winograd_filter_transform_1x4_1x5_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 469 | { "winograd_filter_transform_2x2_7x7_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 470 | { "winograd_filter_transform_2x1_7x1_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 471 | { "winograd_filter_transform_1x2_1x7_nhwc", "nhwc/winograd_filter_transform.cl" }, |
| 472 | { "winograd_input_transform_4x1_3x1_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 473 | { "winograd_input_transform_1x4_1x3_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 474 | { "winograd_input_transform_4x4_3x3_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 475 | { "winograd_input_transform_4x4_5x5_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 476 | { "winograd_input_transform_4x1_5x1_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 477 | { "winograd_input_transform_1x4_1x5_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 478 | { "winograd_input_transform_2x2_7x7_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 479 | { "winograd_input_transform_2x1_7x1_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
| 480 | { "winograd_input_transform_1x2_1x7_stepz1_nhwc", "nhwc/winograd_input_transform.cl" }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 481 | { "winograd_output_transform_4x1_3x1_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 482 | { "winograd_output_transform_1x4_1x3_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 483 | { "winograd_output_transform_4x4_3x3_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 484 | { "winograd_output_transform_4x4_5x5_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 485 | { "winograd_output_transform_4x1_5x1_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 486 | { "winograd_output_transform_1x4_1x5_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 487 | { "winograd_output_transform_2x2_7x7_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 488 | { "winograd_output_transform_2x1_7x1_nhwc", "nhwc/winograd_output_transform.cl" }, |
| 489 | { "winograd_output_transform_1x2_1x7_nhwc", "nhwc/winograd_output_transform.cl" }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 490 | #endif /* ENABLE_NHWC_KERNELS */ |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 491 | }; |
| 492 | |
| 493 | const std::map<std::string, std::string> ClKernelLibrary::_program_source_map = |
| 494 | { |
| 495 | #ifdef EMBEDDED_KERNELS |
| 496 | { |
Jakub Sujak | 3274172 | 2022-11-25 16:43:18 +0000 | [diff] [blame] | 497 | "activation_float_helpers.h", |
| 498 | #include "./cl_kernels/activation_float_helpers.hembed" |
| 499 | }, |
| 500 | { |
| 501 | "activation_quant_helpers.h", |
| 502 | #include "./cl_kernels/activation_quant_helpers.hembed" |
| 503 | }, |
| 504 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 505 | "common/activation_layer.cl", |
| 506 | #include "./cl_kernels/common/activation_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 507 | }, |
| 508 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 509 | "common/activation_layer_quant.cl", |
| 510 | #include "./cl_kernels/common/activation_layer_quant.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 511 | }, |
| 512 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 513 | "common/arg_min_max.cl", |
| 514 | #include "./cl_kernels/common/arg_min_max.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 515 | }, |
| 516 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 517 | "common/bitwise_op.cl", |
| 518 | #include "./cl_kernels/common/bitwise_op.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 519 | }, |
| 520 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 521 | "common/bounding_box_transform.cl", |
| 522 | #include "./cl_kernels/common/bounding_box_transform.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 523 | }, |
| 524 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 525 | "common/bounding_box_transform_quantized.cl", |
| 526 | #include "./cl_kernels/common/bounding_box_transform_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 527 | }, |
| 528 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 529 | "common/col2im.cl", |
| 530 | #include "./cl_kernels/common/col2im.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 531 | }, |
| 532 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 533 | "common/comparisons.cl", |
| 534 | #include "./cl_kernels/common/comparisons.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 535 | }, |
| 536 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 537 | "common/concatenate.cl", |
| 538 | #include "./cl_kernels/common/concatenate.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 539 | }, |
| 540 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 541 | "common/convert_fc_weights.cl", |
| 542 | #include "./cl_kernels/common/convert_fc_weights.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 543 | }, |
| 544 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 545 | "common/convolution_layer.cl", |
| 546 | #include "./cl_kernels/common/convolution_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 547 | }, |
| 548 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 549 | "common/copy_tensor.cl", |
| 550 | #include "./cl_kernels/common/copy_tensor.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 551 | }, |
| 552 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 553 | "common/crop_tensor.cl", |
| 554 | #include "./cl_kernels/common/crop_tensor.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 555 | }, |
| 556 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 557 | "common/deconvolution_layer.cl", |
| 558 | #include "./cl_kernels/common/deconvolution_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 559 | }, |
| 560 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 561 | "common/cast.cl", |
| 562 | #include "./cl_kernels/common/cast.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 563 | }, |
| 564 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 565 | "common/dequantization_layer.cl", |
| 566 | #include "./cl_kernels/common/dequantization_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 567 | }, |
| 568 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 569 | "common/elementwise_operation.cl", |
| 570 | #include "./cl_kernels/common/elementwise_operation.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 571 | }, |
| 572 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 573 | "common/elementwise_operation_quantized.cl", |
| 574 | #include "./cl_kernels/common/elementwise_operation_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 575 | }, |
| 576 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 577 | "common/elementwise_unary.cl", |
| 578 | #include "./cl_kernels/common/elementwise_unary.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 579 | }, |
| 580 | { |
Ramy Elgammal | 14d7b53 | 2023-01-30 04:56:47 +0000 | [diff] [blame] | 581 | "common/elementwise_unary_quantized.cl", |
| 582 | #include "./cl_kernels/common/elementwise_unary_quantized.clembed" |
| 583 | }, |
| 584 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 585 | "common/fft.cl", |
| 586 | #include "./cl_kernels/common/fft.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 587 | }, |
| 588 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 589 | "common/fft_digit_reverse.cl", |
| 590 | #include "./cl_kernels/common/fft_digit_reverse.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 591 | }, |
| 592 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 593 | "common/fft_scale.cl", |
| 594 | #include "./cl_kernels/common/fft_scale.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 595 | }, |
| 596 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 597 | "common/fill_border.cl", |
| 598 | #include "./cl_kernels/common/fill_border.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 599 | }, |
| 600 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 601 | "common/floor.cl", |
| 602 | #include "./cl_kernels/common/floor.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 603 | }, |
| 604 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 605 | "common/gather.cl", |
| 606 | #include "./cl_kernels/common/gather.clembed" |
| 607 | }, |
| 608 | { |
| 609 | "common/gemm.cl", |
| 610 | #include "./cl_kernels/common/gemm.clembed" |
| 611 | }, |
| 612 | { |
Gunes Bayir | 4bfc70e | 2021-12-10 16:17:56 +0000 | [diff] [blame] | 613 | "common/gemm_reshaped_only_rhs_mmul.cl", |
| 614 | #include "./cl_kernels/common/gemm_reshaped_only_rhs_mmul.clembed" |
| 615 | }, |
| 616 | { |
ramelg01 | 9cca592 | 2021-11-11 10:05:00 +0000 | [diff] [blame] | 617 | "common/gemm_utils.cl", |
| 618 | #include "./cl_kernels/common/gemm_utils.clembed" |
| 619 | }, |
| 620 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 621 | "common/gemmlowp.cl", |
| 622 | #include "./cl_kernels/common/gemmlowp.clembed" |
| 623 | }, |
| 624 | { |
Freddie Liardet | e572dff | 2022-05-16 14:09:10 +0100 | [diff] [blame] | 625 | "common/gemmlowp_reshaped_only_rhs_mmul.cl", |
| 626 | #include "./cl_kernels/common/gemmlowp_reshaped_only_rhs_mmul.clembed" |
| 627 | }, |
| 628 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 629 | "common/gemv.cl", |
| 630 | #include "./cl_kernels/common/gemv.clembed" |
| 631 | }, |
| 632 | { |
| 633 | "common/generate_proposals.cl", |
| 634 | #include "./cl_kernels/common/generate_proposals.clembed" |
| 635 | }, |
| 636 | { |
| 637 | "common/generate_proposals_quantized.cl", |
| 638 | #include "./cl_kernels/common/generate_proposals_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 639 | }, |
| 640 | { |
Giorgio Arena | 892b70a | 2022-03-30 12:23:10 +0100 | [diff] [blame] | 641 | "gemm_helpers.h", |
| 642 | #include "./cl_kernels/gemm_helpers.hembed" |
| 643 | }, |
| 644 | { |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 645 | "helpers.h", |
| 646 | #include "./cl_kernels/helpers.hembed" |
| 647 | }, |
| 648 | { |
| 649 | "helpers_asymm.h", |
| 650 | #include "./cl_kernels/helpers_asymm.hembed" |
| 651 | }, |
| 652 | { |
Giorgio Arena | 892b70a | 2022-03-30 12:23:10 +0100 | [diff] [blame] | 653 | "repeat.h", |
| 654 | #include "./cl_kernels/repeat.hembed" |
| 655 | }, |
| 656 | { |
SiCong Li | ca364df | 2022-04-13 15:48:19 +0100 | [diff] [blame] | 657 | "tile_helpers.h", |
| 658 | #include "./cl_kernels/tile_helpers.hembed" |
| 659 | }, |
| 660 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 661 | "common/instance_normalization.cl", |
| 662 | #include "./cl_kernels/common/instance_normalization.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 663 | }, |
| 664 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 665 | "common/l2_normalize.cl", |
| 666 | #include "./cl_kernels/common/l2_normalize.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 667 | }, |
| 668 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 669 | "common/mean_stddev_normalization.cl", |
| 670 | #include "./cl_kernels/common/mean_stddev_normalization.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 671 | }, |
| 672 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 673 | "common/memset.cl", |
| 674 | #include "./cl_kernels/common/memset.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 675 | }, |
| 676 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 677 | "common/minmax_layer.cl", |
| 678 | #include "./cl_kernels/common/minmax_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 679 | }, |
| 680 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 681 | "common/nonmax.cl", |
| 682 | #include "./cl_kernels/common/nonmax.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 683 | }, |
| 684 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 685 | "common/batchnormalization_layer.cl", |
| 686 | #include "./cl_kernels/common/batchnormalization_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 687 | }, |
| 688 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 689 | "common/pad_layer.cl", |
| 690 | #include "./cl_kernels/common/pad_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 691 | }, |
| 692 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 693 | "common/permute.cl", |
| 694 | #include "./cl_kernels/common/permute.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 695 | }, |
| 696 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 697 | "common/pixelwise_mul_float.cl", |
| 698 | #include "./cl_kernels/common/pixelwise_mul_float.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 699 | }, |
| 700 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 701 | "common/pixelwise_mul_int.cl", |
| 702 | #include "./cl_kernels/common/pixelwise_mul_int.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 703 | }, |
| 704 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 705 | "common/qlstm_layer_normalization.cl", |
| 706 | #include "./cl_kernels/common/qlstm_layer_normalization.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 707 | }, |
| 708 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 709 | "common/quantization_layer.cl", |
| 710 | #include "./cl_kernels/common/quantization_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 711 | }, |
| 712 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 713 | "common/range.cl", |
| 714 | #include "./cl_kernels/common/range.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 715 | }, |
| 716 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 717 | "common/reduction_operation.cl", |
| 718 | #include "./cl_kernels/common/reduction_operation.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 719 | }, |
| 720 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 721 | "common/reshape_layer.cl", |
| 722 | #include "./cl_kernels/common/reshape_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 723 | }, |
| 724 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 725 | "common/reverse.cl", |
| 726 | #include "./cl_kernels/common/reverse.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 727 | }, |
| 728 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 729 | "common/roi_align_layer.cl", |
| 730 | #include "./cl_kernels/common/roi_align_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 731 | }, |
| 732 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 733 | "common/roi_align_layer_quantized.cl", |
| 734 | #include "./cl_kernels/common/roi_align_layer_quantized.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 735 | }, |
| 736 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 737 | "common/roi_pooling_layer.cl", |
| 738 | #include "./cl_kernels/common/roi_pooling_layer.clembed" |
| 739 | }, |
| 740 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 741 | "common/select.cl", |
| 742 | #include "./cl_kernels/common/select.clembed" |
| 743 | }, |
| 744 | { |
| 745 | "common/softmax_layer.cl", |
| 746 | #include "./cl_kernels/common/softmax_layer.clembed" |
| 747 | }, |
| 748 | { |
| 749 | "common/softmax_layer_quantized.cl", |
| 750 | #include "./cl_kernels/common/softmax_layer_quantized.clembed" |
| 751 | }, |
| 752 | { |
| 753 | "common/slice_ops.cl", |
| 754 | #include "./cl_kernels/common/slice_ops.clembed" |
| 755 | }, |
| 756 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 757 | "common/stack_layer.cl", |
| 758 | #include "./cl_kernels/common/stack_layer.clembed" |
| 759 | }, |
| 760 | { |
| 761 | "common/tile.cl", |
| 762 | #include "./cl_kernels/common/tile.clembed" |
| 763 | }, |
| 764 | { |
| 765 | "common/transpose.cl", |
| 766 | #include "./cl_kernels/common/transpose.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 767 | }, |
| 768 | { |
| 769 | "types.h", |
| 770 | #include "./cl_kernels/types.hembed" |
| 771 | }, |
| 772 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 773 | "common/unpooling_layer.cl", |
| 774 | #include "./cl_kernels/common/unpooling_layer.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 775 | }, |
Ramy Elgammal | 2b6ebfe | 2023-03-09 21:15:37 +0000 | [diff] [blame] | 776 | { |
| 777 | "common/mat_mul.cl", |
| 778 | #include "./cl_kernels/common/mat_mul.clembed" |
| 779 | }, |
Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 780 | { |
SiCong Li | a8d8058 | 2023-05-19 14:23:37 +0100 | [diff] [blame] | 781 | "common/mat_mul_mmul.cl", |
| 782 | #include "./cl_kernels/common/mat_mul_mmul.clembed" |
| 783 | }, |
| 784 | { |
Gunes Bayir | 9d0c4de | 2023-04-13 18:22:58 +0100 | [diff] [blame] | 785 | "common/mat_mul_quantized.cl", |
| 786 | #include "./cl_kernels/common/mat_mul_quantized.clembed" |
| 787 | }, |
Gunes Bayir | e87fa66 | 2023-09-07 12:20:33 +0100 | [diff] [blame] | 788 | { |
| 789 | "common/mat_mul_quantized_mmul.cl", |
| 790 | #include "./cl_kernels/common/mat_mul_quantized_mmul.clembed" |
| 791 | }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 792 | #ifdef ENABLE_NCHW_KERNELS |
| 793 | { |
| 794 | "nchw/batch_to_space.cl", |
| 795 | #include "./cl_kernels/nchw/batch_to_space.clembed" |
| 796 | }, |
| 797 | { |
| 798 | "nchw/channel_shuffle.cl", |
| 799 | #include "./cl_kernels/nchw/channel_shuffle.clembed" |
| 800 | }, |
| 801 | { |
| 802 | "nchw/upsample_layer.cl", |
| 803 | #include "./cl_kernels/nchw/upsample_layer.clembed" |
| 804 | }, |
| 805 | { |
| 806 | "nchw/depth_to_space.cl", |
| 807 | #include "./cl_kernels/nchw/depth_to_space.clembed" |
| 808 | }, |
| 809 | { |
| 810 | "nchw/dequantization_layer.cl", |
| 811 | #include "./cl_kernels/nchw/dequantization_layer.clembed" |
| 812 | }, |
| 813 | { |
Adnan AlSinan | 3012435 | 2021-12-02 19:12:20 +0000 | [diff] [blame] | 814 | "nchw/direct_convolution.cl", |
| 815 | #include "./cl_kernels/nchw/direct_convolution.clembed" |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 816 | }, |
| 817 | { |
| 818 | "nchw/im2col.cl", |
| 819 | #include "./cl_kernels/nchw/im2col.clembed" |
| 820 | }, |
| 821 | { |
| 822 | "nchw/normalization_layer.cl", |
| 823 | #include "./cl_kernels/nchw/normalization_layer.clembed" |
| 824 | }, |
| 825 | { |
| 826 | "nchw/normalize_planar_yuv_layer.cl", |
| 827 | #include "./cl_kernels/nchw/normalize_planar_yuv_layer.clembed" |
| 828 | }, |
| 829 | { |
| 830 | "nchw/normalize_planar_yuv_layer_quantized.cl", |
| 831 | #include "./cl_kernels/nchw/normalize_planar_yuv_layer_quantized.clembed" |
| 832 | }, |
| 833 | { |
| 834 | "nchw/batchnormalization_layer.cl", |
| 835 | #include "./cl_kernels/nchw/batchnormalization_layer.clembed" |
| 836 | }, |
| 837 | { |
| 838 | "nchw/pooling_layer.cl", |
| 839 | #include "./cl_kernels/nchw/pooling_layer.clembed" |
| 840 | }, |
| 841 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 842 | "nchw/prior_box_layer.cl", |
| 843 | #include "./cl_kernels/nchw/prior_box_layer.clembed" |
| 844 | }, |
| 845 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 846 | "nchw/reorg_layer.cl", |
| 847 | #include "./cl_kernels/nchw/reorg_layer.clembed" |
| 848 | }, |
| 849 | { |
| 850 | "nchw/scale.cl", |
| 851 | #include "./cl_kernels/nchw/scale.clembed" |
| 852 | }, |
| 853 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 854 | "nchw/space_to_batch.cl", |
| 855 | #include "./cl_kernels/nchw/space_to_batch.clembed" |
| 856 | }, |
| 857 | { |
| 858 | "nchw/space_to_depth.cl", |
| 859 | #include "./cl_kernels/nchw/space_to_depth.clembed" |
| 860 | }, |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 861 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 862 | "nchw/winograd_filter_transform.cl", |
| 863 | #include "./cl_kernels/nchw/winograd_filter_transform.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 864 | }, |
| 865 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 866 | "nchw/winograd_input_transform.cl", |
| 867 | #include "./cl_kernels/nchw/winograd_input_transform.clembed" |
| 868 | }, |
| 869 | { |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 870 | "nchw/winograd_output_transform.cl", |
| 871 | #include "./cl_kernels/nchw/winograd_output_transform.clembed" |
| 872 | }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 873 | #endif /* ENABLE_NCHW_KERNELS */ |
| 874 | |
| 875 | #ifdef ENABLE_NHWC_KERNELS |
| 876 | { |
| 877 | "nhwc/batch_to_space.cl", |
| 878 | #include "./cl_kernels/nhwc/batch_to_space.clembed" |
| 879 | }, |
| 880 | { |
| 881 | "nhwc/channel_shuffle.cl", |
| 882 | #include "./cl_kernels/nhwc/channel_shuffle.clembed" |
| 883 | }, |
| 884 | { |
| 885 | "nhwc/upsample_layer.cl", |
| 886 | #include "./cl_kernels/nhwc/upsample_layer.clembed" |
| 887 | }, |
| 888 | { |
| 889 | "nhwc/depth_to_space.cl", |
| 890 | #include "./cl_kernels/nhwc/depth_to_space.clembed" |
| 891 | }, |
| 892 | { |
| 893 | "nhwc/dequantization_layer.cl", |
| 894 | #include "./cl_kernels/nhwc/dequantization_layer.clembed" |
| 895 | }, |
| 896 | { |
| 897 | "nhwc/direct_convolution.cl", |
| 898 | #include "./cl_kernels/nhwc/direct_convolution.clembed" |
| 899 | }, |
| 900 | { |
Giorgio Arena | 945ae9e | 2021-10-13 11:13:04 +0100 | [diff] [blame] | 901 | "nhwc/direct_convolution3d.cl", |
| 902 | #include "./cl_kernels/nhwc/direct_convolution3d.clembed" |
| 903 | }, |
| 904 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 905 | "nhwc/dwc_native_fp_nhwc.cl", |
| 906 | #include "./cl_kernels/nhwc/dwc_native_fp_nhwc.clembed" |
| 907 | }, |
| 908 | { |
| 909 | "nhwc/dwc_native_quantized_nhwc.cl", |
| 910 | #include "./cl_kernels/nhwc/dwc_native_quantized_nhwc.clembed" |
| 911 | }, |
| 912 | { |
| 913 | "nhwc/normalization_layer.cl", |
| 914 | #include "./cl_kernels/nhwc/normalization_layer.clembed" |
| 915 | }, |
| 916 | { |
| 917 | "nhwc/normalize_planar_yuv_layer.cl", |
| 918 | #include "./cl_kernels/nhwc/normalize_planar_yuv_layer.clembed" |
| 919 | }, |
| 920 | { |
| 921 | "nhwc/normalize_planar_yuv_layer_quantized.cl", |
| 922 | #include "./cl_kernels/nhwc/normalize_planar_yuv_layer_quantized.clembed" |
| 923 | }, |
| 924 | { |
| 925 | "nhwc/im2col.cl", |
| 926 | #include "./cl_kernels/nhwc/im2col.clembed" |
| 927 | }, |
| 928 | { |
Gian Marco Iodice | 5d01681 | 2022-11-17 11:03:39 +0000 | [diff] [blame] | 929 | "nhwc/indirect_convolution.cl", |
| 930 | #include "./cl_kernels/nhwc/indirect_convolution.clembed" |
| 931 | }, |
| 932 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 933 | "nhwc/batchnormalization_layer.cl", |
| 934 | #include "./cl_kernels/nhwc/batchnormalization_layer.clembed" |
| 935 | }, |
| 936 | { |
| 937 | "nhwc/pooling_layer.cl", |
| 938 | #include "./cl_kernels/nhwc/pooling_layer.clembed" |
| 939 | }, |
| 940 | { |
ramelg01 | 3751569 | 2022-02-26 22:06:20 +0000 | [diff] [blame] | 941 | "nhwc/pooling_3d_layer.cl", |
| 942 | #include "./cl_kernels/nhwc/pooling_3d_layer.clembed" |
| 943 | }, |
| 944 | { |
Mohammed Suhail Munshi | 5e549fa | 2022-03-16 11:14:06 +0000 | [diff] [blame] | 945 | "nhwc/pooling_3d_layer_quantized.cl", |
| 946 | #include "./cl_kernels/nhwc/pooling_3d_layer_quantized.clembed" |
| 947 | }, |
| 948 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 949 | "nhwc/pooling_layer_quantized.cl", |
| 950 | #include "./cl_kernels/nhwc/pooling_layer_quantized.clembed" |
| 951 | }, |
| 952 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 953 | "nhwc/reorg_layer.cl", |
| 954 | #include "./cl_kernels/nhwc/reorg_layer.clembed" |
| 955 | }, |
| 956 | { |
| 957 | "nhwc/scale.cl", |
| 958 | #include "./cl_kernels/nhwc/scale.clembed" |
| 959 | }, |
| 960 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 961 | "nhwc/space_to_batch.cl", |
| 962 | #include "./cl_kernels/nhwc/space_to_batch.clembed" |
| 963 | }, |
| 964 | { |
| 965 | "nhwc/space_to_depth.cl", |
| 966 | #include "./cl_kernels/nhwc/space_to_depth.clembed" |
| 967 | }, |
| 968 | { |
Gunes Bayir | ec0113d | 2022-11-09 09:26:27 +0000 | [diff] [blame] | 969 | "nhwc/transposed_convolution.cl", |
| 970 | #include "./cl_kernels/nhwc/transposed_convolution.clembed" |
| 971 | }, |
| 972 | { |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 973 | "nhwc/winograd_filter_transform.cl", |
| 974 | #include "./cl_kernels/nhwc/winograd_filter_transform.clembed" |
| 975 | }, |
| 976 | { |
| 977 | "nhwc/winograd_input_transform.cl", |
| 978 | #include "./cl_kernels/nhwc/winograd_input_transform.clembed" |
| 979 | }, |
Adnan AlSinan | 7075fe2 | 2021-07-05 13:12:52 +0100 | [diff] [blame] | 980 | { |
| 981 | "nhwc/winograd_output_transform.cl", |
| 982 | #include "./cl_kernels/nhwc/winograd_output_transform.clembed" |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 983 | }, |
Adnan AlSinan | f81f51c | 2021-07-26 18:18:37 +0100 | [diff] [blame] | 984 | #endif /* ENABLE_NHWC_KERNELS */ |
Georgios Pinitas | 908f616 | 2021-05-04 10:11:09 +0100 | [diff] [blame] | 985 | #endif /* EMBEDDED_KERNELS */ |
| 986 | }; |
| 987 | |
| 988 | ClKernelLibrary &ClKernelLibrary::get() |
| 989 | { |
| 990 | static ClKernelLibrary _kernel_library; |
| 991 | return _kernel_library; |
| 992 | } |
| 993 | |
| 994 | std::string ClKernelLibrary::program_name(const std::string &kernel_name) const |
| 995 | { |
| 996 | // Find which program contains the kernel |
| 997 | auto kernel_program_it = _kernel_program_map.find(kernel_name); |
| 998 | |
| 999 | if(_kernel_program_map.end() == kernel_program_it) |
| 1000 | { |
| 1001 | ARM_COMPUTE_ERROR_VAR("Kernel %s not found in the CLKernelLibrary", kernel_name.c_str()); |
| 1002 | } |
| 1003 | |
| 1004 | const std::string program_name = kernel_program_it->second; |
| 1005 | |
| 1006 | return program_name; |
| 1007 | } |
| 1008 | |
| 1009 | void ClKernelLibrary::set_kernel_path(std::string kernel_path) |
| 1010 | { |
| 1011 | _kernel_path = std::move(kernel_path); |
| 1012 | _kernel_path += "/"; |
| 1013 | } |
| 1014 | |
| 1015 | const std::string &ClKernelLibrary::kernel_path() const |
| 1016 | { |
| 1017 | return _kernel_path; |
| 1018 | } |
| 1019 | |
| 1020 | ClKernelLibrary::ClProgramInfo ClKernelLibrary::program(const std::string &program_name) const |
| 1021 | { |
| 1022 | #ifdef EMBEDDED_KERNELS |
| 1023 | #ifdef ARM_COMPUTE_COMPRESSED_KERNELS |
| 1024 | const auto inflatted_program_source_it = _decompressed_source_map.find(program_name); |
| 1025 | if(inflatted_program_source_it != _decompressed_source_map.end()) |
| 1026 | { |
| 1027 | return ClProgramInfo{ inflatted_program_source_it->second, false }; |
| 1028 | } |
| 1029 | #endif /* ARM_COMPUTE_COMPRESSED_KERNELS */ |
| 1030 | |
| 1031 | const auto program_source_it = _program_source_map.find(program_name); |
| 1032 | if(program_source_it == _program_source_map.end()) |
| 1033 | { |
| 1034 | ARM_COMPUTE_ERROR_VAR("Embedded program for %s does not exist.", program_name.c_str()); |
| 1035 | } |
| 1036 | std::string program_source = program_source_it->second; |
| 1037 | |
| 1038 | #ifdef ARM_COMPUTE_COMPRESSED_KERNELS |
| 1039 | std::string decompressed_program_source = decompress_zlib(decode_base64(program_source_it->second)); |
| 1040 | ARM_COMPUTE_ERROR_ON_MSG(decompressed_program_source.empty(), "Cannot de-compress requested program"); |
| 1041 | _decompressed_source_map.insert(std::make_pair(program_name, decompressed_program_source)); |
| 1042 | program_source = std::move(decompressed_program_source); |
| 1043 | #endif /* ARM_COMPUTE_COMPRESSED_KERNELS */ |
| 1044 | |
| 1045 | return ClProgramInfo{ program_source, false }; |
| 1046 | #else /* EMBEDDED_KERNELS */ |
| 1047 | // Check for binary |
| 1048 | std::string source_name = _kernel_path + program_name; |
| 1049 | std::string binary_name = source_name + "bin"; |
| 1050 | std::string program_source{}; |
| 1051 | bool is_binary = false; |
| 1052 | |
| 1053 | if(std::ifstream(binary_name).is_open()) |
| 1054 | { |
| 1055 | program_source = read_file(binary_name, true); |
| 1056 | is_binary = true; |
| 1057 | } |
| 1058 | else if(std::ifstream(source_name).is_open()) |
| 1059 | { |
| 1060 | program_source = read_file(source_name, false); |
| 1061 | } |
| 1062 | else |
| 1063 | { |
| 1064 | ARM_COMPUTE_ERROR_VAR("Kernel file %s does not exist.", source_name.c_str()); |
| 1065 | } |
| 1066 | |
| 1067 | return ClProgramInfo{ program_source, is_binary }; |
| 1068 | #endif /* EMBEDDED_KERNELS */ |
| 1069 | } |
| 1070 | } // namespace opencl |
| 1071 | } // namespace arm_compute |