|
10 | 10 | //
|
11 | 11 | //===----------------------------------------------------------------------===//
|
12 | 12 |
|
13 |
| -// Macro OPENCLEXT or OPENCLEXT_INTERNAL can be defined to enumerate the |
| 13 | +// Macro OPENCLEXTNAME or OPENCL_GENERIC_EXTENSION can be defined to enumerate all |
14 | 14 | // OpenCL extensions listed in this file.
|
15 | 15 | //
|
16 |
| -// If the extensions are to be enumerated without the supported OpenCL version, |
17 |
| -// define OPENCLEXT(ext) where ext is the name of the extension. |
18 |
| -// |
19 |
| -// If the extensions are to be enumerated with supported OpenCL version, |
20 |
| -// define OPENCLEXT_INTERNAL(ext, avail, core) where |
| 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, avail, core, opt) where |
21 | 20 | // ext - name of the extension or optional core feature.
|
22 | 21 | // avail - minimum OpenCL version supporting it.
|
23 |
| -// core - minimum OpenCL version when the extension becomes optional core |
24 |
| -// feature or core feature. ~0U indicates not a core feature or an |
25 |
| -// optional core feature. |
| 22 | +// core - OpenCL versions mask when the extension becomes core feature. |
| 23 | +// 0U indicates not a core feature. |
| 24 | +// opt - OpenCL versions mask when the extension becomes optional core |
| 25 | +// feature. 0U indicates not a optional core feature. |
| 26 | +// |
| 27 | +// If extensions are to be enumerated without any information, |
| 28 | +// define OPENCLEXTNAME(ext) where ext is the name of the extension. |
| 29 | +// |
| 30 | +// Difference between optional core feature and core feature is that the |
| 31 | +// later is unconditionally supported in specific OpenCL version. |
26 | 32 | //
|
27 | 33 | // As per The OpenCL Extension Specification, Section 1.2, in this file, an
|
28 | 34 | // extension is defined if and only it either:
|
|
32 | 38 | // For such an extension, a preprocessor #define that matches the extension
|
33 | 39 | // name must be created and a #pragma is required if and only if the
|
34 | 40 | // compilation flow is impacted, e.g. due to a difference of syntax or
|
35 |
| -// semantics in the language compared to the core standard. |
| 41 | +// semantics in the language compared to the core standard. #pragma directive |
| 42 | +// has no effect for optional core and core features. |
36 | 43 |
|
37 |
| -#ifndef OPENCLEXT_INTERNAL |
38 |
| -#ifndef OPENCLEXT |
39 |
| -#pragma error "macro OPENCLEXT or OPENCLEXT_INTERNAL is required" |
| 44 | +#ifndef OPENCL_GENERIC_EXTENSION |
| 45 | +#ifndef OPENCLEXTNAME |
| 46 | +#pragma error "macro OPENCLEXTNAME or OPENCL_GENERIC_EXTENSION is required" |
40 | 47 | #else
|
41 |
| -#define OPENCLEXT_INTERNAL(ext, ...) OPENCLEXT(ext) |
42 |
| -#endif // OPENCLEXT |
43 |
| -#endif // OPENCLEXT_INTERNAL |
| 48 | +#define OPENCL_GENERIC_EXTENSION(ext, ...) OPENCLEXTNAME(ext) |
| 49 | +#endif // OPENCLEXTNAME |
| 50 | +#endif // OPENCL_GENERIC_EXTENSION |
| 51 | + |
| 52 | +// Declaration helpers |
| 53 | +#define OPENCL_EXTENSION(ext, avail) OPENCL_GENERIC_EXTENSION(ext, avail, 0U, 0U) |
| 54 | +#define OPENCL_COREFEATURE(ext, avail, core) OPENCL_GENERIC_EXTENSION(ext, avail, core, 0U) |
| 55 | +#define OPENCL_OPTIONALCOREFEATURE(ext, avail, opt) OPENCL_GENERIC_EXTENSION(ext, avail, 0U, opt) |
44 | 56 |
|
45 | 57 | // OpenCL 1.0.
|
46 |
| -OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 200) |
47 |
| -OPENCLEXT_INTERNAL(cl_khr_byte_addressable_store, 100, 110) |
48 |
| -OPENCLEXT_INTERNAL(cl_khr_fp16, 100, ~0U) |
49 |
| -OPENCLEXT_INTERNAL(cl_khr_fp64, 100, 120) |
50 |
| -OPENCLEXT_INTERNAL(cl_khr_global_int32_base_atomics, 100, 110) |
51 |
| -OPENCLEXT_INTERNAL(cl_khr_global_int32_extended_atomics, 100, 110) |
52 |
| -OPENCLEXT_INTERNAL(cl_khr_local_int32_base_atomics, 100, 110) |
53 |
| -OPENCLEXT_INTERNAL(cl_khr_local_int32_extended_atomics, 100, 110) |
54 |
| -OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 100, ~0U) |
55 |
| -OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 100, ~0U) |
| 58 | +OPENCL_COREFEATURE(cl_khr_byte_addressable_store, 100, OCL_C_11P) |
| 59 | +OPENCL_COREFEATURE(cl_khr_global_int32_base_atomics, 100, OCL_C_11P) |
| 60 | +OPENCL_COREFEATURE(cl_khr_global_int32_extended_atomics, 100, OCL_C_11P) |
| 61 | +OPENCL_COREFEATURE(cl_khr_local_int32_base_atomics, 100, OCL_C_11P) |
| 62 | +OPENCL_COREFEATURE(cl_khr_local_int32_extended_atomics, 100, OCL_C_11P) |
| 63 | +OPENCL_OPTIONALCOREFEATURE(cl_khr_fp64, 100, OCL_C_12P) |
| 64 | +OPENCL_EXTENSION(cl_khr_fp16, 100) |
| 65 | +OPENCL_EXTENSION(cl_khr_int64_base_atomics, 100) |
| 66 | +OPENCL_EXTENSION(cl_khr_int64_extended_atomics, 100) |
| 67 | +OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, 100, OCL_C_20, OCL_C_30) |
56 | 68 |
|
57 | 69 | // EMBEDDED_PROFILE
|
58 |
| -OPENCLEXT_INTERNAL(cles_khr_int64, 110, ~0U) |
| 70 | +OPENCL_EXTENSION(cles_khr_int64, 110) |
59 | 71 |
|
60 | 72 | // OpenCL 1.2.
|
61 |
| -OPENCLEXT_INTERNAL(cl_khr_depth_images, 120, ~0U) |
62 |
| -OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 120, ~0U) |
| 73 | +OPENCL_EXTENSION(cl_khr_depth_images, 120) |
| 74 | +OPENCL_EXTENSION(cl_khr_gl_msaa_sharing, 120) |
63 | 75 |
|
64 | 76 | // OpenCL 2.0.
|
65 |
| -OPENCLEXT_INTERNAL(cl_khr_mipmap_image, 200, ~0U) |
66 |
| -OPENCLEXT_INTERNAL(cl_khr_mipmap_image_writes, 200, ~0U) |
67 |
| -OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U) |
68 |
| -OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U) |
| 77 | +OPENCL_EXTENSION(cl_khr_mipmap_image, 200) |
| 78 | +OPENCL_EXTENSION(cl_khr_mipmap_image_writes, 200) |
| 79 | +OPENCL_EXTENSION(cl_khr_srgb_image_writes, 200) |
| 80 | +OPENCL_EXTENSION(cl_khr_subgroups, 200) |
69 | 81 |
|
70 | 82 | // Clang Extensions.
|
71 |
| -OPENCLEXT_INTERNAL(cl_clang_storage_class_specifiers, 100, ~0U) |
72 |
| -OPENCLEXT_INTERNAL(__cl_clang_function_pointers, 100, ~0U) |
73 |
| -OPENCLEXT_INTERNAL(__cl_clang_variadic_functions, 100, ~0U) |
| 83 | +OPENCL_EXTENSION(cl_clang_storage_class_specifiers, 100) |
| 84 | +OPENCL_EXTENSION(__cl_clang_function_pointers, 100) |
| 85 | +OPENCL_EXTENSION(__cl_clang_variadic_functions, 100) |
74 | 86 |
|
75 | 87 | // AMD OpenCL extensions
|
76 |
| -OPENCLEXT_INTERNAL(cl_amd_media_ops, 100, ~0U) |
77 |
| -OPENCLEXT_INTERNAL(cl_amd_media_ops2, 100, ~0U) |
| 88 | +OPENCL_EXTENSION(cl_amd_media_ops, 100) |
| 89 | +OPENCL_EXTENSION(cl_amd_media_ops2, 100) |
78 | 90 |
|
79 | 91 | // ARM OpenCL extensions
|
80 |
| -OPENCLEXT_INTERNAL(cl_arm_integer_dot_product_int8, 120, ~0U) |
81 |
| -OPENCLEXT_INTERNAL(cl_arm_integer_dot_product_accumulate_int8, 120, ~0U) |
82 |
| -OPENCLEXT_INTERNAL(cl_arm_integer_dot_product_accumulate_int16, 120, ~0U) |
83 |
| -OPENCLEXT_INTERNAL(cl_arm_integer_dot_product_accumulate_saturate_int8, 120, ~0U) |
| 92 | +OPENCL_EXTENSION(cl_arm_integer_dot_product_int8, 120) |
| 93 | +OPENCL_EXTENSION(cl_arm_integer_dot_product_accumulate_int8, 120) |
| 94 | +OPENCL_EXTENSION(cl_arm_integer_dot_product_accumulate_int16, 120) |
| 95 | +OPENCL_EXTENSION(cl_arm_integer_dot_product_accumulate_saturate_int8, 120) |
84 | 96 |
|
85 | 97 | // Intel OpenCL extensions
|
86 |
| -OPENCLEXT_INTERNAL(cl_intel_subgroups, 120, ~0U) |
87 |
| -OPENCLEXT_INTERNAL(cl_intel_subgroups_short, 120, ~0U) |
88 |
| -OPENCLEXT_INTERNAL(cl_intel_device_side_avc_motion_estimation, 120, ~0U) |
| 98 | +OPENCL_EXTENSION(cl_intel_subgroups, 120) |
| 99 | +OPENCL_EXTENSION(cl_intel_subgroups_short, 120) |
| 100 | +OPENCL_EXTENSION(cl_intel_device_side_avc_motion_estimation, 120) |
| 101 | + |
89 | 102 |
|
90 |
| -#undef OPENCLEXT_INTERNAL |
| 103 | +#undef OPENCL_OPTIONALCOREFEATURE |
| 104 | +#undef OPENCL_COREFEATURE |
| 105 | +#undef OPENCL_GENERIC_EXTENSION |
91 | 106 |
|
92 |
| -#ifdef OPENCLEXT |
93 |
| -#undef OPENCLEXT |
| 107 | +#ifdef OPENCLEXTNAME |
| 108 | +#undef OPENCLEXTNAME |
94 | 109 | #endif
|
0 commit comments