1 /* 2 * Copyright (c) 2017-2022 Arm Limited. 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a copy 7 * of this software and associated documentation files (the "Software"), to 8 * deal in the Software without restriction, including without limitation the 9 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 10 * sell copies of the Software, and to permit persons to whom the Software is 11 * furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in all 14 * copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 * SOFTWARE. 23 */ 24 #ifndef ARM_COMPUTE_CL_TYPES_H 25 #define ARM_COMPUTE_CL_TYPES_H 26 27 #include "arm_compute/core/CL/ICLArray.h" 28 #include "arm_compute/core/GPUTarget.h" 29 30 #include <set> 31 #include <string> 32 33 namespace arm_compute 34 { 35 /** Default string for the CLKernel configuration id */ 36 static const std::string default_config_id = "no_config_id"; 37 38 /** Available OpenCL Version */ 39 enum class CLVersion 40 { 41 CL10, /* the OpenCL 1.0 */ 42 CL11, /* the OpenCL 1.1 */ 43 CL12, /* the OpenCL 1.2 */ 44 CL20, /* the OpenCL 2.x */ 45 CL30, /* the OpenCL 3.x */ 46 UNKNOWN /* unkown version */ 47 }; 48 49 /** OpenCL device options */ 50 struct CLDeviceOptions 51 { 52 std::string name{}; /**< Device name */ 53 std::string device_version{}; /**< Device version string */ 54 std::set<std::string> extensions{}; /**< List of supported extensions */ 55 std::string ddk_version{}; /**< DDK version */ 56 GPUTarget gpu_target{}; /**< GPU target architecture/instance */ 57 CLVersion version{}; /**< Device OpenCL version */ 58 size_t compute_units{}; /**< Number of compute units */ 59 size_t cache_size{}; /**< Cache size */ 60 }; 61 62 /** OpenCL quantization data */ 63 struct CLQuantization 64 { 65 /** Default Constructor */ CLQuantizationCLQuantization66 CLQuantization() 67 : scale(nullptr), offset(nullptr) {}; 68 /** Constructor 69 * 70 * @param[in] scale OpenCL scale array 71 * @param[in] offset OpenCL offset array 72 */ CLQuantizationCLQuantization73 CLQuantization(const ICLFloatArray *scale, const ICLInt32Array *offset) 74 : scale(scale), offset(offset) {}; 75 76 const ICLFloatArray *scale; /**< Quantization scale array */ 77 const ICLInt32Array *offset; /**< Quantization offset array */ 78 }; 79 80 enum CLKernelType 81 { 82 UNKNOWN, /**< Unknown CL kernel type */ 83 DEPTHWISE, /**< Depthwise CL kernel type */ 84 DIRECT, /**< Direct Convolution CL kernel type */ 85 ELEMENTWISE, /**< Elementwise CL kernel type */ 86 GEMM, /**< GEMM CL kernel type */ 87 POOL, /**< Pool CL kernel type */ 88 WINOGRAD /**< Winograd CL kernel type */ 89 }; 90 } // namespace arm_compute 91 #endif /* ARM_COMPUTE_CL_TYPES_H */ 92