| 1 | //===--- OpenCLExtensions.def - OpenCL extension list -----------*- C++ -*-===// |
| 2 | // |
| 3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 4 | // See https://llvm.org/LICENSE.txt for license information. |
| 5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 6 | // |
| 7 | //===----------------------------------------------------------------------===// |
| 8 | // |
| 9 | // This file defines the list of supported OpenCL extensions. |
| 10 | // |
| 11 | //===----------------------------------------------------------------------===// |
| 12 | |
| 13 | // Macro OPENCLEXTNAME or OPENCL_GENERIC_EXTENSION can be defined to enumerate all |
| 14 | // OpenCL extensions listed in this file. |
| 15 | // |
| 16 | // If extensions are to be enumerated with information about whether |
| 17 | // an extension is core or optional core and minimum OpenCL version |
| 18 | // when an extension becomes available, |
| 19 | // define OPENCL_GENERIC_EXTENSION(ext, pragma, avail, core, opt) where |
| 20 | // ext - name of the extension or optional core feature. |
| 21 | // pragma - true if extension needs pragmas or false otherwise. |
| 22 | // NOTE: extension pragma without any documentation detailing |
| 23 | // its behavior explicitly is deprecated. Therefore the default |
| 24 | // value is false. |
| 25 | // avail - minimum OpenCL version supporting it. |
| 26 | // core - OpenCL versions mask when the extension becomes core feature. |
| 27 | // 0U indicates not a core feature. |
| 28 | // opt - OpenCL versions mask when the extension becomes optional core |
| 29 | // feature. 0U indicates not a optional core feature. |
| 30 | // |
| 31 | // If extensions are to be enumerated without any information, |
| 32 | // define OPENCLEXTNAME(ext) where ext is the name of the extension. |
| 33 | // |
| 34 | // Difference between optional core feature and core feature is that the |
| 35 | // later is unconditionally supported in specific OpenCL version. |
| 36 | // |
| 37 | // As per The OpenCL Extension Specification, Section 1.2, in this file, an |
| 38 | // extension is defined if and only it either: |
| 39 | // * affects the OpenCL language semantics or its syntax, |
| 40 | // * adds built-in functions to the language. |
| 41 | // |
| 42 | // For such an extension, a preprocessor #define that matches the extension |
| 43 | // name must be created and a #pragma is required if and only if the |
| 44 | // compilation flow is impacted, e.g. due to a difference of syntax or |
| 45 | // semantics in the language compared to the core standard. #pragma directive |
| 46 | // has no effect for optional core and core features. |
| 47 | |
| 48 | #ifndef OPENCL_GENERIC_EXTENSION |
| 49 | #ifndef OPENCLEXTNAME |
| 50 | #pragma error "macro OPENCLEXTNAME or OPENCL_GENERIC_EXTENSION is required" |
| 51 | #else |
| 52 | #define OPENCL_GENERIC_EXTENSION(ext, ...) OPENCLEXTNAME(ext) |
| 53 | #endif // OPENCLEXTNAME |
| 54 | #endif // OPENCL_GENERIC_EXTENSION |
| 55 | |
| 56 | // Declaration helpers |
| 57 | #define OPENCL_EXTENSION(ext, pragma, avail) OPENCL_GENERIC_EXTENSION(ext, pragma, avail, 0U, 0U) |
| 58 | #define OPENCL_COREFEATURE(ext, pragma, avail, core) OPENCL_GENERIC_EXTENSION(ext, pragma, avail, core, 0U) |
| 59 | #define OPENCL_OPTIONALCOREFEATURE(ext, pragma, avail, opt) OPENCL_GENERIC_EXTENSION(ext, pragma, avail, 0U, opt) |
| 60 | |
| 61 | // OpenCL 1.0. |
| 62 | OPENCL_COREFEATURE(cl_khr_byte_addressable_store, true, 100, OCL_C_11P) |
| 63 | OPENCL_COREFEATURE(cl_khr_global_int32_base_atomics, true, 100, OCL_C_11P) |
| 64 | OPENCL_COREFEATURE(cl_khr_global_int32_extended_atomics, true, 100, OCL_C_11P) |
| 65 | OPENCL_COREFEATURE(cl_khr_local_int32_base_atomics, true, 100, OCL_C_11P) |
| 66 | OPENCL_COREFEATURE(cl_khr_local_int32_extended_atomics, true, 100, OCL_C_11P) |
| 67 | OPENCL_OPTIONALCOREFEATURE(cl_khr_fp64, true, 100, OCL_C_12P) |
| 68 | OPENCL_EXTENSION(cl_khr_fp16, true, 100) |
| 69 | OPENCL_EXTENSION(cl_khr_int64_base_atomics, true, 100) |
| 70 | OPENCL_EXTENSION(cl_khr_int64_extended_atomics, true, 100) |
| 71 | OPENCL_EXTENSION(cl_khr_depth_images, true, 100) |
| 72 | OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 100) |
| 73 | OPENCL_EXTENSION(cl_ext_float_atomics, false, 100) |
| 74 | OPENCL_EXTENSION(cl_khr_gl_msaa_sharing, true, 100) |
| 75 | OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 100) |
| 76 | OPENCL_EXTENSION(cl_khr_kernel_clock, false, 100) |
| 77 | OPENCL_EXTENSION(cl_khr_mipmap_image, true, 100) |
| 78 | OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 100) |
| 79 | OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 100) |
| 80 | OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 100) |
| 81 | OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 100) |
| 82 | OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 100) |
| 83 | OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 100) |
| 84 | OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 100) |
| 85 | OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 100) |
| 86 | OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 100) |
| 87 | OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 100) |
| 88 | OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 100) |
| 89 | OPENCL_EXTENSION(cl_khr_subgroups, true, 100) |
| 90 | OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30) |
| 91 | |
| 92 | // EMBEDDED_PROFILE |
| 93 | OPENCL_EXTENSION(cles_khr_int64, true, 100) |
| 94 | |
| 95 | // OpenCL 2.0. |
| 96 | OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_acq_rel, false, 200, OCL_C_20, OCL_C_30) |
| 97 | OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_seq_cst, false, 200, OCL_C_20, OCL_C_30) |
| 98 | OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_scope_all_devices, false, 200, OCL_C_20, OCL_C_30) |
| 99 | OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_scope_device, false, 200, OCL_C_20, OCL_C_30) |
| 100 | OPENCL_GENERIC_EXTENSION(__opencl_c_device_enqueue, false, 200, OCL_C_20, OCL_C_30) |
| 101 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_global_atomic_add, false, 200, OCL_C_20) |
| 102 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_global_atomic_load_store, false, 200, OCL_C_20) |
| 103 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_global_atomic_min_max, false, 200, OCL_C_20) |
| 104 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_local_atomic_add, false, 200, OCL_C_20) |
| 105 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_local_atomic_load_store, false, 200, OCL_C_20) |
| 106 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_local_atomic_min_max, false, 200, OCL_C_20) |
| 107 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_global_atomic_add, false, 200, OCL_C_20) |
| 108 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_global_atomic_min_max, false, 200, OCL_C_20) |
| 109 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_local_atomic_add, false, 200, OCL_C_20) |
| 110 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_local_atomic_min_max, false, 200, OCL_C_20) |
| 111 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_global_atomic_add, false, 200, OCL_C_20) |
| 112 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_global_atomic_min_max, false, 200, OCL_C_20) |
| 113 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_local_atomic_add, false, 200, OCL_C_20) |
| 114 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_local_atomic_min_max, false, 200, OCL_C_20) |
| 115 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_raw10_raw12, false, 200, OCL_C_20) |
| 116 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unorm_int_2_101010, false, 200, OCL_C_20) |
| 117 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unsigned_10x6_12x4_14x2, false, 200, OCL_C_20) |
| 118 | OPENCL_GENERIC_EXTENSION(__opencl_c_generic_address_space, false, 200, OCL_C_20, OCL_C_30) |
| 119 | OPENCL_GENERIC_EXTENSION(__opencl_c_images, false, 200, OCL_C_20, OCL_C_30) |
| 120 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit, false, 200, OCL_C_20) |
| 121 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit_packed, false, 200, OCL_C_20) |
| 122 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_device, false, 200, OCL_C_20) |
| 123 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_sub_group, false, 200, OCL_C_20) |
| 124 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_work_group, false, 200, OCL_C_20) |
| 125 | OPENCL_GENERIC_EXTENSION(__opencl_c_pipes, false, 200, OCL_C_20, OCL_C_30) |
| 126 | OPENCL_GENERIC_EXTENSION(__opencl_c_program_scope_global_variables, false, 200, OCL_C_20, OCL_C_30) |
| 127 | OPENCL_GENERIC_EXTENSION(__opencl_c_read_write_images, false, 200, OCL_C_20, OCL_C_30) |
| 128 | OPENCL_GENERIC_EXTENSION(__opencl_c_work_group_collective_functions, false, 200, OCL_C_20, OCL_C_30) |
| 129 | |
| 130 | // Clang Extensions. |
| 131 | OPENCL_EXTENSION(cl_clang_storage_class_specifiers, true, 100) |
| 132 | OPENCL_EXTENSION(__cl_clang_function_pointers, true, 100) |
| 133 | OPENCL_EXTENSION(__cl_clang_variadic_functions, true, 100) |
| 134 | OPENCL_EXTENSION(__cl_clang_function_scope_local_variables, true, 100) |
| 135 | OPENCL_EXTENSION(__cl_clang_non_portable_kernel_param_types, true, 100) |
| 136 | OPENCL_EXTENSION(__cl_clang_bitfields, true, 100) |
| 137 | |
| 138 | // AMD OpenCL extensions |
| 139 | OPENCL_EXTENSION(cl_amd_media_ops, true, 100) |
| 140 | OPENCL_EXTENSION(cl_amd_media_ops2, true, 100) |
| 141 | |
| 142 | // Intel OpenCL extensions |
| 143 | OPENCL_EXTENSION(cl_intel_bfloat16_conversions, false, 100) |
| 144 | OPENCL_EXTENSION(cl_intel_required_subgroup_size, false, 200) |
| 145 | OPENCL_EXTENSION(cl_intel_subgroups, true, 120) |
| 146 | OPENCL_EXTENSION(cl_intel_subgroups_char, true, 120) |
| 147 | OPENCL_EXTENSION(cl_intel_subgroups_long, true, 120) |
| 148 | OPENCL_EXTENSION(cl_intel_subgroups_short, true, 120) |
| 149 | OPENCL_EXTENSION(cl_intel_subgroup_buffer_prefetch, false, 120) |
| 150 | OPENCL_EXTENSION(cl_intel_subgroup_local_block_io, false, 120) |
| 151 | OPENCL_EXTENSION(cl_intel_device_side_avc_motion_estimation, true, 120) |
| 152 | |
| 153 | // OpenCL C 3.0 features (6.2.1. Features) |
| 154 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_3d_image_writes, false, 300, OCL_C_30) |
| 155 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_fp64, false, 300, OCL_C_30) |
| 156 | OPENCL_OPTIONALCOREFEATURE(__opencl_c_subgroups, false, 300, OCL_C_30) |
| 157 | |
| 158 | #undef OPENCL_OPTIONALCOREFEATURE |
| 159 | #undef OPENCL_COREFEATURE |
| 160 | #undef OPENCL_GENERIC_EXTENSION |
| 161 | |
| 162 | #ifdef OPENCLEXTNAME |
| 163 | #undef OPENCLEXTNAME |
| 164 | #endif |
| 165 | |