[clang] [OpenCL] Set KHR extensions minimum version to OpenCL 1.0 (PR #175120)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 8 21:50:39 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Wenju He (wenju-he)
<details>
<summary>Changes</summary>
Motivation is similar to 25cfdaa4e9dc. Their spec don't specify a required OpenCL version. Targets may expose them before OpenCL 1.2.
Set KHR extensions (depth images, mipmaps, subgroups, kernel clock, dot product, ext_float_atomics, extended_bit_ops) to availability 1.0.
Changes to opencl-c.h:
* Relax header and test guards to allow extension macros whenever any OpenCL C version is defined.
* Relax cl_khr_depth_images guard to allow cl_khr_depth_images, OpenCL C++, or OpenCL C 2.0+, since image2d_depth_t and image2d_array_depth_t types require that coverage.
* Guard image1d_t, image1d_array_t and image2d_array_t types with OpenCL C++ or OpenCL C 1.2+ to match with OpenCL C spec.
Relates to https://github.com/KhronosGroup/OpenCL-CTS/pull/2376.
---
Patch is 56.79 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/175120.diff
6 Files Affected:
- (modified) clang/include/clang/Basic/OpenCLExtensions.def (+19-21)
- (modified) clang/lib/Headers/opencl-c.h (+147-85)
- (modified) clang/test/Headers/opencl-c-header.cl (+101-51)
- (modified) clang/test/Misc/amdgcn.languageOptsOpenCL.cl (+2-2)
- (modified) clang/test/SemaOpenCL/extension-version.cl (+20-20)
- (modified) clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl (+4-4)
``````````diff
diff --git a/clang/include/clang/Basic/OpenCLExtensions.def b/clang/include/clang/Basic/OpenCLExtensions.def
index 3abc0279de791..d6c0b585d1809 100644
--- a/clang/include/clang/Basic/OpenCLExtensions.def
+++ b/clang/include/clang/Basic/OpenCLExtensions.def
@@ -68,33 +68,31 @@ OPENCL_OPTIONALCOREFEATURE(cl_khr_fp64, true, 100, OCL_C_12P)
OPENCL_EXTENSION(cl_khr_fp16, true, 100)
OPENCL_EXTENSION(cl_khr_int64_base_atomics, true, 100)
OPENCL_EXTENSION(cl_khr_int64_extended_atomics, true, 100)
+OPENCL_EXTENSION(cl_khr_depth_images, true, 100)
+OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 100)
+OPENCL_EXTENSION(cl_ext_float_atomics, false, 100)
OPENCL_EXTENSION(cl_khr_gl_msaa_sharing, true, 100)
+OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 100)
+OPENCL_EXTENSION(cl_khr_kernel_clock, false, 100)
+OPENCL_EXTENSION(cl_khr_mipmap_image, true, 100)
+OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 100)
+OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 100)
+OPENCL_EXTENSION(cl_khr_subgroups, true, 100)
OPENCL_GENERIC_EXTENSION(cl_khr_3d_image_writes, true, 100, OCL_C_20, OCL_C_30)
// EMBEDDED_PROFILE
-OPENCL_EXTENSION(cles_khr_int64, true, 110)
-
-// OpenCL 1.2.
-OPENCL_EXTENSION(cl_khr_depth_images, true, 120)
+OPENCL_EXTENSION(cles_khr_int64, true, 100)
// OpenCL 2.0.
-OPENCL_EXTENSION(cl_ext_float_atomics, false, 200)
-OPENCL_EXTENSION(cl_khr_extended_bit_ops, false, 200)
-OPENCL_EXTENSION(cl_khr_integer_dot_product, false, 200)
-OPENCL_EXTENSION(cl_khr_kernel_clock, false, 200)
-OPENCL_EXTENSION(cl_khr_mipmap_image, true, 200)
-OPENCL_EXTENSION(cl_khr_mipmap_image_writes, true, 200)
-OPENCL_EXTENSION(cl_khr_srgb_image_writes, true, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_ballot, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_clustered_reduce, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_extended_types, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_named_barrier, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_arithmetic, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_non_uniform_vote, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_rotate, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_shuffle_relative, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroup_shuffle, false, 200)
-OPENCL_EXTENSION(cl_khr_subgroups, true, 200)
OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_acq_rel, false, 200, OCL_C_20, OCL_C_30)
OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_order_seq_cst, false, 200, OCL_C_20, OCL_C_30)
OPENCL_GENERIC_EXTENSION(__opencl_c_atomic_scope_all_devices, false, 200, OCL_C_20, OCL_C_30)
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 72a1333ee05dc..08645f4745601 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -17,6 +17,13 @@
#endif //cl_khr_depth_images
#endif //defined(__opencl_c_images)
+#if defined(cl_khr_depth_images) || defined(__OPENCL_CPP_VERSION__) || \
+ (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+// Internal feature macro to provide depth image builtins.
+#define __opencl_depth_image_builtins 1
+#endif // defined(cl_khr_depth_images) || defined(__OPENCL_CPP_VERSION__) ||
+ // (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+
#if __OPENCL_C_VERSION__ < CL_VERSION_2_0
#ifdef cl_khr_3d_image_writes
#pragma OPENCL EXTENSION cl_khr_3d_image_writes : enable
@@ -15199,8 +15206,8 @@ float4 __ovld __purefn read_imagef(read_only image2d_array_t, sampler_t, float4)
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, int4);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, float4);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t, int4);
-uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t, float4);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
+uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t,
+ float4);
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, int);
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, float);
@@ -15210,7 +15217,6 @@ int4 __ovld __purefn read_imagei(read_only image1d_t, sampler_t, float);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, int);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float);
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t, int2);
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t, float2);
@@ -15220,13 +15226,13 @@ uint4 __ovld __purefn read_imageui(read_only image1d_array_t, sampler_t, int2);
uint4 __ovld __purefn read_imageui(read_only image1d_array_t, sampler_t, float2);
#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t, float2);
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t, int2);
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t, float4);
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t, int4);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
float4 __ovld __purefn read_imagef(read_only image2d_msaa_t, int2, int);
@@ -15243,9 +15249,10 @@ float __ovld __purefn read_imagef(read_only image2d_array_msaa_depth_t, int4, in
#endif //cl_khr_gl_msaa_sharing
// OpenCL Extension v2.0 s9.18 - Mipmaps
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#if defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
#ifdef cl_khr_mipmap_image
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, float, float);
int4 __ovld __purefn read_imagei(read_only image1d_t, sampler_t, float, float);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float, float);
@@ -15253,27 +15260,31 @@ uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float, float)
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t, float2, float);
int4 __ovld __purefn read_imagei(read_only image1d_array_t, sampler_t, float2, float);
uint4 __ovld __purefn read_imageui(read_only image1d_array_t, sampler_t, float2, float);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_t, sampler_t, float2, float);
int4 __ovld __purefn read_imagei(read_only image2d_t, sampler_t, float2, float);
uint4 __ovld __purefn read_imageui(read_only image2d_t, sampler_t, float2, float);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t, float2, float);
-#endif // cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_array_t, sampler_t, float4, float);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, float4, float);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t, float4, float);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t, float4, float);
-#endif // cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
float4 __ovld __purefn read_imagef(read_only image3d_t, sampler_t, float4, float);
int4 __ovld __purefn read_imagei(read_only image3d_t, sampler_t, float4, float);
uint4 __ovld __purefn read_imageui(read_only image3d_t, sampler_t, float4, float);
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image1d_t, sampler_t, float, float, float);
int4 __ovld __purefn read_imagei(read_only image1d_t, sampler_t, float, float, float);
uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float, float, float);
@@ -15281,31 +15292,34 @@ uint4 __ovld __purefn read_imageui(read_only image1d_t, sampler_t, float, float,
float4 __ovld __purefn read_imagef(read_only image1d_array_t, sampler_t, float2, float, float);
int4 __ovld __purefn read_imagei(read_only image1d_array_t, sampler_t, float2, float, float);
uint4 __ovld __purefn read_imageui(read_only image1d_array_t, sampler_t, float2, float, float);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_t, sampler_t, float2, float2, float2);
int4 __ovld __purefn read_imagei(read_only image2d_t, sampler_t, float2, float2, float2);
uint4 __ovld __purefn read_imageui(read_only image2d_t, sampler_t, float2, float2, float2);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_only image2d_depth_t, sampler_t, float2, float2, float2);
-#endif // cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
float4 __ovld __purefn read_imagef(read_only image2d_array_t, sampler_t, float4, float2, float2);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, sampler_t, float4, float2, float2);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, sampler_t, float4, float2, float2);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, sampler_t, float4, float2, float2);
-#endif // cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
float4 __ovld __purefn read_imagef(read_only image3d_t, sampler_t, float4, float4, float4);
int4 __ovld __purefn read_imagei(read_only image3d_t, sampler_t, float4, float4, float4);
uint4 __ovld __purefn read_imageui(read_only image3d_t, sampler_t, float4, float4, float4);
#endif //cl_khr_mipmap_image
-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#endif // defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
+#if defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
/**
* Sampler-less Image Access
@@ -15331,36 +15345,39 @@ float4 __ovld __purefn read_imagef(read_only image2d_array_t, int4);
int4 __ovld __purefn read_imagei(read_only image2d_array_t, int4);
uint4 __ovld __purefn read_imageui(read_only image2d_array_t, int4);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_only image2d_depth_t, int2);
float __ovld __purefn read_imagef(read_only image2d_array_depth_t, int4);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
float4 __ovld __purefn read_imagef(read_only image3d_t, int4);
int4 __ovld __purefn read_imagei(read_only image3d_t, int4);
uint4 __ovld __purefn read_imageui(read_only image3d_t, int4);
-#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
+#endif // defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
// Image read functions returning half4 type
#ifdef cl_khr_fp16
-half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, int);
-half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, float);
half4 __ovld __purefn read_imageh(read_only image2d_t, sampler_t, int2);
half4 __ovld __purefn read_imageh(read_only image2d_t, sampler_t, float2);
half4 __ovld __purefn read_imageh(read_only image3d_t, sampler_t, int4);
half4 __ovld __purefn read_imageh(read_only image3d_t, sampler_t, float4);
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
+half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, int);
+half4 __ovld __purefn read_imageh(read_only image1d_t, sampler_t, float);
half4 __ovld __purefn read_imageh(read_only image1d_array_t, sampler_t, int2);
half4 __ovld __purefn read_imageh(read_only image1d_array_t, sampler_t, float2);
half4 __ovld __purefn read_imageh(read_only image2d_array_t, sampler_t, int4);
half4 __ovld __purefn read_imageh(read_only image2d_array_t, sampler_t, float4);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
+ // CL_VERSION_1_2)
/**
* Sampler-less Image Access
*/
-half4 __ovld __purefn read_imageh(read_only image1d_t, int);
half4 __ovld __purefn read_imageh(read_only image2d_t, int2);
half4 __ovld __purefn read_imageh(read_only image3d_t, int4);
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
+half4 __ovld __purefn read_imageh(read_only image1d_t, int);
half4 __ovld __purefn read_imageh(read_only image1d_array_t, int2);
half4 __ovld __purefn read_imageh(read_only image2d_array_t, int4);
half4 __ovld __purefn read_imageh(read_only image1d_buffer_t, int);
@@ -15395,10 +15412,10 @@ int4 __ovld __purefn read_imagei(read_write image3d_t, int4);
uint4 __ovld __purefn read_imageui(read_write image3d_t, int4);
#endif // cl_khr_3d_image_writes
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_depth_t, int2);
float __ovld __purefn read_imagef(read_write image2d_array_depth_t, int4);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if cl_khr_gl_msaa_sharing
float4 __ovld __purefn read_imagef(read_write image2d_msaa_t, int2, int);
@@ -15414,6 +15431,7 @@ float __ovld __purefn read_imagef(read_write image2d_array_msaa_depth_t, int4, i
#endif //cl_khr_gl_msaa_sharing
#ifdef cl_khr_mipmap_image
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image1d_t, sampler_t, float, float);
int4 __ovld __purefn read_imagei(read_write image1d_t, sampler_t, float, float);
uint4 __ovld __purefn read_imageui(read_write image1d_t, sampler_t, float, float);
@@ -15421,18 +15439,27 @@ uint4 __ovld __purefn read_imageui(read_write image1d_t, sampler_t, float, float
float4 __ovld __purefn read_imagef(read_write image1d_array_t, sampler_t, float2, float);
int4 __ovld __purefn read_imagei(read_write image1d_array_t, sampler_t, float2, float);
uint4 __ovld __purefn read_imageui(read_write image1d_array_t, sampler_t, float2, float);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
+ // CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_t, sampler_t, float2, float);
int4 __ovld __purefn read_imagei(read_write image2d_t, sampler_t, float2, float);
uint4 __ovld __purefn read_imageui(read_write image2d_t, sampler_t, float2, float);
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_depth_t, sampler_t, float2, float);
+#endif // defined(__opencl_depth_image_builtins)
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_array_t, sampler_t, float4, float);
int4 __ovld __purefn read_imagei(read_write image2d_array_t, sampler_t, float4, float);
uint4 __ovld __purefn read_imageui(read_write image2d_array_t, sampler_t, float4, float);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
+ // CL_VERSION_1_2)
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_array_depth_t, sampler_t, float4, float);
+#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
float4 __ovld __purefn read_imagef(read_write image3d_t, sampler_t, float4, float);
@@ -15440,6 +15467,7 @@ int4 __ovld __purefn read_imagei(read_write image3d_t, sampler_t, float4, float)
uint4 __ovld __purefn read_imageui(read_write image3d_t, sampler_t, float4, float);
#endif // cl_khr_3d_image_writes
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image1d_t, sampler_t, float, float, float);
int4 __ovld __purefn read_imagei(read_write image1d_t, sampler_t, float, float, float);
uint4 __ovld __purefn read_imageui(read_write image1d_t, sampler_t, float, float, float);
@@ -15447,18 +15475,27 @@ uint4 __ovld __purefn read_imageui(read_write image1d_t, sampler_t, float, float
float4 __ovld __purefn read_imagef(read_write image1d_array_t, sampler_t, float2, float, float);
int4 __ovld __purefn read_imagei(read_write image1d_array_t, sampler_t, float2, float, float);
uint4 __ovld __purefn read_imageui(read_write image1d_array_t, sampler_t, float2, float, float);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
+ // CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_t, sampler_t, float2, float2, float2);
int4 __ovld __purefn read_imagei(read_write image2d_t, sampler_t, float2, float2, float2);
uint4 __ovld __purefn read_imageui(read_write image2d_t, sampler_t, float2, float2, float2);
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_depth_t, sampler_t, float2, float2, float2);
+#endif // defined(__opencl_depth_image_builtins)
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
float4 __ovld __purefn read_imagef(read_write image2d_array_t, sampler_t, float4, float2, float2);
int4 __ovld __purefn read_imagei(read_write image2d_array_t, sampler_t, float4, float2, float2);
uint4 __ovld __purefn read_imageui(read_write image2d_array_t, sampler_t, float4, float2, float2);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
+ // CL_VERSION_1_2)
+#if defined(__opencl_depth_image_builtins)
float __ovld __purefn read_imagef(read_write image2d_array_depth_t, sampler_t, float4, float2, float2);
+#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
float4 __ovld __purefn read_imagef(read_write image3d_t, sampler_t, float4, float4, float4);
@@ -15574,14 +15611,14 @@ void __ovld write_imagei(write_only image3d_t, int4, int4);
void __ovld write_imageui(write_only image3d_t, int4, uint4);
#endif
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
void __ovld write_imagef(write_only image2d_depth_t, int2, float);
void __ovld write_imagef(write_only image2d_array_depth_t, int4, float);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
// OpenCL Extension v2.0 s9.18 - Mipmaps
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
#if defined(cl_khr_mipmap_image_writes)
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
void __ovld write_imagef(write_only image1d_t, int, int, float4);
void __ovld write_imagei(write_only image1d_t, int, int, int4);
void __ovld write_imageui(write_only image1d_t, int, int, uint4);
@@ -15590,16 +15627,20 @@ void __ovld write_imagef(write_only image1d_array_t, int2, int, float4);
void __ovld write_imagei(write_only image1d_array_t, int2, int, int4);
void __ovld write_imageui(write_only image1d_array_t, int2, int, uint4);
-void __ovld write_imagef(write_only image2d_t, int2, int, float4);
-void __ovld write_imagei(write_only image2d_t, int2, int, int4);
-void __ovld write_imageui(write_only image2d_t, int2, int, uint4);
-
void __ovld write_imagef(write_only image2d_array_t, int4, int, float4);
void __ovld write_imagei(write_only image2d_array_t, int4, int, int4);
void __ovld write_imageui(write_only image2d_array_t, int4, int, uint4);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >...
[truncated]
``````````
</details>
https://github.com/llvm/llvm-project/pull/175120
More information about the cfe-commits
mailing list