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_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30)
72
73// EMBEDDED_PROFILE
74OPENCL_EXTENSION(cles_khr_int64, true, 110)
75
76// OpenCL 1.2.
77OPENCL_EXTENSION(cl_khr_depth_images, true, 120)
78OPENCL_EXTENSION(cl_khr_gl_msaa_sharing,true, 120)
79
80// OpenCL 2.0.
81OPENCL_EXTENSION(cl_khr_mipmap_image, true, 200)
82OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 200)
83OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 200)
84OPENCL_EXTENSION(cl_khr_subgroups, true, 200)
85
86// Clang Extensions.
87OPENCL_EXTENSION(cl_clang_storage_class_specifiers, true, 100)
88OPENCL_EXTENSION(__cl_clang_function_pointers, true, 100)
89OPENCL_EXTENSION(__cl_clang_variadic_functions, true, 100)
90OPENCL_EXTENSION(__cl_clang_non_portable_kernel_param_types, true, 100)
91OPENCL_EXTENSION(__cl_clang_bitfields, true, 100)
92
93// AMD OpenCL extensions
94OPENCL_EXTENSION(cl_amd_media_ops, true, 100)
95OPENCL_EXTENSION(cl_amd_media_ops2, true, 100)
96
97// Intel OpenCL extensions
98OPENCL_EXTENSION(cl_intel_subgroups, true, 120)
99OPENCL_EXTENSION(cl_intel_subgroups_short, true, 120)
100OPENCL_EXTENSION(cl_intel_device_side_avc_motion_estimation, true, 120)
101
102// OpenCL C 3.0 features (6.2.1. Features)
103OPENCL_OPTIONALCOREFEATURE(__opencl_c_pipes, false, 300, OCL_C_30)
104OPENCL_OPTIONALCOREFEATURE(__opencl_c_generic_address_space, false, 300, OCL_C_30)
105OPENCL_OPTIONALCOREFEATURE(__opencl_c_atomic_order_acq_rel, false, 300, OCL_C_30)
106OPENCL_OPTIONALCOREFEATURE(__opencl_c_atomic_order_seq_cst, false, 300, OCL_C_30)
107OPENCL_OPTIONALCOREFEATURE(__opencl_c_subgroups, false, 300, OCL_C_30)
108OPENCL_OPTIONALCOREFEATURE(__opencl_c_3d_image_writes, false, 300, OCL_C_30)
109OPENCL_OPTIONALCOREFEATURE(__opencl_c_device_enqueue, false, 300, OCL_C_30)
110OPENCL_OPTIONALCOREFEATURE(__opencl_c_read_write_images, false, 300, OCL_C_30)
111OPENCL_OPTIONALCOREFEATURE(__opencl_c_program_scope_global_variables, false, 300, OCL_C_30)
112OPENCL_OPTIONALCOREFEATURE(__opencl_c_fp64, false, 300, OCL_C_30)
113OPENCL_OPTIONALCOREFEATURE(__opencl_c_images, false, 300, OCL_C_30)
114
115#undef OPENCL_OPTIONALCOREFEATURE
116#undef OPENCL_COREFEATURE
117#undef OPENCL_GENERIC_EXTENSION
118
119#ifdef OPENCLEXTNAME
120#undef OPENCLEXTNAME
121#endif
122

source code of clang/include/clang/Basic/OpenCLExtensions.def