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.
62OPENCL_COREFEATURE(cl_khr_byte_addressable_store, true, 100, OCL_C_11P)
63OPENCL_COREFEATURE(cl_khr_global_int32_base_atomics, true, 100, OCL_C_11P)
64OPENCL_COREFEATURE(cl_khr_global_int32_extended_atomics, true, 100, OCL_C_11P)
65OPENCL_COREFEATURE(cl_khr_local_int32_base_atomics, true, 100, OCL_C_11P)
66OPENCL_COREFEATURE(cl_khr_local_int32_extended_atomics, true, 100, OCL_C_11P)
67OPENCL_OPTIONALCOREFEATURE(cl_khr_fp64, true, 100, OCL_C_12P)
68OPENCL_EXTENSION(cl_khr_fp16, true, 100)
69OPENCL_EXTENSION(cl_khr_int64_base_atomics, true, 100)
70OPENCL_EXTENSION(cl_khr_int64_extended_atomics, true, 100)
71OPENCL_EXTENSION(cl_khr_depth_images, true, 100)
72OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 100)
73OPENCL_EXTENSION(cl_ext_float_atomics, false, 100)
74OPENCL_EXTENSION(cl_khr_gl_msaa_sharing, true, 100)
75OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 100)
76OPENCL_EXTENSION(cl_khr_kernel_clock, false, 100)
77OPENCL_EXTENSION(cl_khr_mipmap_image, true, 100)
78OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 100)
79OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 100)
80OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 100)
81OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 100)
82OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 100)
83OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 100)
84OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 100)
85OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 100)
86OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 100)
87OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 100)
88OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 100)
89OPENCL_EXTENSION(cl_khr_subgroups, true, 100)
90OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30)
91
92// EMBEDDED_PROFILE
93OPENCL_EXTENSION(cles_khr_int64, true, 100)
94
95// OpenCL 2.0.
96OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_acq_rel, false, 200, OCL_C_20, OCL_C_30)
97OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_seq_cst, false, 200, OCL_C_20, OCL_C_30)
98OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_scope_all_devices, false, 200, OCL_C_20, OCL_C_30)
99OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_scope_device, false, 200, OCL_C_20, OCL_C_30)
100OPENCL_GENERIC_EXTENSION(__opencl_c_device_enqueue, false, 200, OCL_C_20, OCL_C_30)
101OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_global_atomic_add, false, 200, OCL_C_20)
102OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_global_atomic_load_store, false, 200, OCL_C_20)
103OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_global_atomic_min_max, false, 200, OCL_C_20)
104OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_local_atomic_add, false, 200, OCL_C_20)
105OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_local_atomic_load_store, false, 200, OCL_C_20)
106OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp16_local_atomic_min_max, false, 200, OCL_C_20)
107OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_global_atomic_add, false, 200, OCL_C_20)
108OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_global_atomic_min_max, false, 200, OCL_C_20)
109OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_local_atomic_add, false, 200, OCL_C_20)
110OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp32_local_atomic_min_max, false, 200, OCL_C_20)
111OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_global_atomic_add, false, 200, OCL_C_20)
112OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_global_atomic_min_max, false, 200, OCL_C_20)
113OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_local_atomic_add, false, 200, OCL_C_20)
114OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_fp64_local_atomic_min_max, false, 200, OCL_C_20)
115OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_raw10_raw12, false, 200, OCL_C_20)
116OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unorm_int_2_101010, false, 200, OCL_C_20)
117OPENCL_OPTIONALCOREFEATURE(__opencl_c_ext_image_unsigned_10x6_12x4_14x2, false, 200, OCL_C_20)
118OPENCL_GENERIC_EXTENSION(__opencl_c_generic_address_space, false, 200, OCL_C_20, OCL_C_30)
119OPENCL_GENERIC_EXTENSION(__opencl_c_images, false, 200, OCL_C_20, OCL_C_30)
120OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit, false, 200, OCL_C_20)
121OPENCL_OPTIONALCOREFEATURE(__opencl_c_integer_dot_product_input_4x8bit_packed, false, 200, OCL_C_20)
122OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_device, false, 200, OCL_C_20)
123OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_sub_group, false, 200, OCL_C_20)
124OPENCL_OPTIONALCOREFEATURE(__opencl_c_kernel_clock_scope_work_group, false, 200, OCL_C_20)
125OPENCL_GENERIC_EXTENSION(__opencl_c_pipes, false, 200, OCL_C_20, OCL_C_30)
126OPENCL_GENERIC_EXTENSION(__opencl_c_program_scope_global_variables, false, 200, OCL_C_20, OCL_C_30)
127OPENCL_GENERIC_EXTENSION(__opencl_c_read_write_images, false, 200, OCL_C_20, OCL_C_30)
128OPENCL_GENERIC_EXTENSION(__opencl_c_work_group_collective_functions, false, 200, OCL_C_20, OCL_C_30)
129
130// Clang Extensions.
131OPENCL_EXTENSION(cl_clang_storage_class_specifiers, true, 100)
132OPENCL_EXTENSION(__cl_clang_function_pointers, true, 100)
133OPENCL_EXTENSION(__cl_clang_variadic_functions, true, 100)
134OPENCL_EXTENSION(__cl_clang_function_scope_local_variables, true, 100)
135OPENCL_EXTENSION(__cl_clang_non_portable_kernel_param_types, true, 100)
136OPENCL_EXTENSION(__cl_clang_bitfields, true, 100)
137
138// AMD OpenCL extensions
139OPENCL_EXTENSION(cl_amd_media_ops, true, 100)
140OPENCL_EXTENSION(cl_amd_media_ops2, true, 100)
141
142// Intel OpenCL extensions
143OPENCL_EXTENSION(cl_intel_bfloat16_conversions, false, 100)
144OPENCL_EXTENSION(cl_intel_required_subgroup_size, false, 200)
145OPENCL_EXTENSION(cl_intel_subgroups, true, 120)
146OPENCL_EXTENSION(cl_intel_subgroups_char, true, 120)
147OPENCL_EXTENSION(cl_intel_subgroups_long, true, 120)
148OPENCL_EXTENSION(cl_intel_subgroups_short, true, 120)
149OPENCL_EXTENSION(cl_intel_subgroup_buffer_prefetch, false, 120)
150OPENCL_EXTENSION(cl_intel_subgroup_local_block_io, false, 120)
151OPENCL_EXTENSION(cl_intel_device_side_avc_motion_estimation, true, 120)
152
153// OpenCL C 3.0 features (6.2.1. Features)
154OPENCL_OPTIONALCOREFEATURE(__opencl_c_3d_image_writes, false, 300, OCL_C_30)
155OPENCL_OPTIONALCOREFEATURE(__opencl_c_fp64, false, 300, OCL_C_30)
156OPENCL_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