[clang] [OpenCL] Set KHR extensions minimum version to OpenCL 1.0 (2nd try) (PR #176681)
Wenju He via cfe-commits
cfe-commits at lists.llvm.org
Sun Jan 18 17:43:14 PST 2026
https://github.com/wenju-he created https://github.com/llvm/llvm-project/pull/176681
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, cles_khr_int64) 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.
Update: The first attempt was reverted in #175993, but the proper fix for the regression described in #175993 is to update ROCm/llvm-project's opencl-c.h which has inlined opencl-c-base.h.
>From 6b1dc3598c398020ed12ff81608590aed539af69 Mon Sep 17 00:00:00 2001
From: Wenju He <wenju.he at intel.com>
Date: Mon, 19 Jan 2026 02:39:25 +0100
Subject: [PATCH] [OpenCL] Set KHR extensions minimum version to OpenCL 1.0
(2nd try)
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, cles_khr_int64) 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.
Update: The first attempt was reverted in #175993, but the proper fix
for the regression described in #175993 is to update ROCm/llvm-project's
opencl-c.h which has inlined opencl-c-base.h.
---
.../include/clang/Basic/OpenCLExtensions.def | 40 ++--
clang/lib/Headers/opencl-c-base.h | 7 +
clang/lib/Headers/opencl-c.h | 219 +++++++++++-------
clang/lib/Sema/OpenCLBuiltins.td | 2 +-
clang/test/Headers/opencl-c-header.cl | 152 ++++++++----
clang/test/Misc/amdgcn.languageOptsOpenCL.cl | 4 +-
clang/test/SemaOpenCL/extension-version.cl | 40 ++--
.../SemaOpenCL/fdeclare-opencl-builtins.cl | 139 +++++++++--
8 files changed, 410 insertions(+), 193 deletions(-)
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-base.h b/clang/lib/Headers/opencl-c-base.h
index 898026c66614a..5e24aa60b8d7f 100644
--- a/clang/lib/Headers/opencl-c-base.h
+++ b/clang/lib/Headers/opencl-c-base.h
@@ -20,6 +20,13 @@
#define __opencl_subgroup_builtins 1
#endif
+#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)
+
// built-in scalar data types:
/**
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 8c19f0f72f6c8..f4c7dbae2a00c 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -15199,8 +15199,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 +15210,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 +15219,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 +15242,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 +15253,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 +15285,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 +15338,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 +15405,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 +15424,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 +15432,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 +15460,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 +15468,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 +15604,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 +15620,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__ >=
+ // CL_VERSION_1_2)
+
+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);
+#if defined(__opencl_depth_image_builtins)
void __ovld write_imagef(write_only image2d_depth_t, int2, int, float);
void __ovld write_imagef(write_only image2d_array_depth_t, int4, int, float);
+#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
void __ovld write_imagef(write_only image3d_t, int4, int, float4);
@@ -15607,8 +15641,7 @@ void __ovld write_imagei(write_only image3d_t, int4, int, int4);
void __ovld write_imageui(write_only image3d_t, int4, int, uint4);
#endif //cl_khr_3d_image_writes
-#endif //defined(cl_khr_mipmap_image_writes)
-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#endif // defined(cl_khr_mipmap_image_writes)
// Image write functions for half4 type
#ifdef cl_khr_fp16
@@ -15650,12 +15683,13 @@ void __ovld write_imagei(read_write image3d_t, int4, int4);
void __ovld write_imageui(read_write image3d_t, int4, uint4);
#endif
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
void __ovld write_imagef(read_write image2d_depth_t, int2, float);
void __ovld write_imagef(read_write image2d_array_depth_t, int4, float);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_mipmap_image_writes)
+#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
void __ovld write_imagef(read_write image1d_t, int, int, float4);
void __ovld write_imagei(read_write image1d_t, int, int, int4);
void __ovld write_imageui(read_write image1d_t, int, int, uint4);
@@ -15664,16 +15698,20 @@ void __ovld write_imagef(read_write image1d_array_t, int2, int, float4);
void __ovld write_imagei(read_write image1d_array_t, int2, int, int4);
void __ovld write_imageui(read_write image1d_array_t, int2, int, uint4);
-void __ovld write_imagef(read_write image2d_t, int2, int, float4);
-void __ovld write_imagei(read_write image2d_t, int2, int, int4);
-void __ovld write_imageui(read_write image2d_t, int2, int, uint4);
-
void __ovld write_imagef(read_write image2d_array_t, int4, int, float4);
void __ovld write_imagei(read_write image2d_array_t, int4, int, int4);
void __ovld write_imageui(read_write image2d_array_t, int4, int, uint4);
+#endif // defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >=
+ // CL_VERSION_1_2)
+
+void __ovld write_imagef(read_write image2d_t, int2, int, float4);
+void __ovld write_imagei(read_write image2d_t, int2, int, int4);
+void __ovld write_imageui(read_write image2d_t, int2, int, uint4);
+#if defined(__opencl_depth_image_builtins)
void __ovld write_imagef(read_write image2d_depth_t, int2, int, float);
void __ovld write_imagef(read_write image2d_array_depth_t, int4, int, float);
+#endif // defined(__opencl_depth_image_builtins)
#ifdef cl_khr_3d_image_writes
void __ovld write_imagef(read_write image3d_t, int4, int, float4);
@@ -15710,10 +15748,10 @@ int __ovld __cnfn get_image_width(read_only image2d_t);
int __ovld __cnfn get_image_width(read_only image3d_t);
int __ovld __cnfn get_image_width(read_only image1d_array_t);
int __ovld __cnfn get_image_width(read_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_width(read_only image2d_depth_t);
int __ovld __cnfn get_image_width(read_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_width(read_only image2d_msaa_t);
int __ovld __cnfn get_image_width(read_only image2d_msaa_depth_t);
@@ -15729,10 +15767,10 @@ int __ovld __cnfn get_image_width(write_only image3d_t);
#endif
int __ovld __cnfn get_image_width(write_only image1d_array_t);
int __ovld __cnfn get_image_width(write_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_width(write_only image2d_depth_t);
int __ovld __cnfn get_image_width(write_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_width(write_only image2d_msaa_t);
int __ovld __cnfn get_image_width(write_only image2d_msaa_depth_t);
@@ -15749,10 +15787,10 @@ int __ovld __cnfn get_image_width(read_write image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_width(read_write image1d_array_t);
int __ovld __cnfn get_image_width(read_write image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_width(read_write image2d_depth_t);
int __ovld __cnfn get_image_width(read_write image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_width(read_write image2d_msaa_t);
int __ovld __cnfn get_image_width(read_write image2d_msaa_depth_t);
@@ -15767,10 +15805,10 @@ int __ovld __cnfn get_image_width(read_write image2d_array_msaa_depth_t);
int __ovld __cnfn get_image_height(read_only image2d_t);
int __ovld __cnfn get_image_height(read_only image3d_t);
int __ovld __cnfn get_image_height(read_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_height(read_only image2d_depth_t);
int __ovld __cnfn get_image_height(read_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_height(read_only image2d_msaa_t);
int __ovld __cnfn get_image_height(read_only image2d_msaa_depth_t);
@@ -15783,10 +15821,10 @@ int __ovld __cnfn get_image_height(write_only image2d_t);
int __ovld __cnfn get_image_height(write_only image3d_t);
#endif
int __ovld __cnfn get_image_height(write_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_height(write_only image2d_depth_t);
int __ovld __cnfn get_image_height(write_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_height(write_only image2d_msaa_t);
int __ovld __cnfn get_image_height(write_only image2d_msaa_depth_t);
@@ -15800,10 +15838,10 @@ int __ovld __cnfn get_image_height(read_write image2d_t);
int __ovld __cnfn get_image_height(read_write image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_height(read_write image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_height(read_write image2d_depth_t);
int __ovld __cnfn get_image_height(read_write image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_height(read_write image2d_msaa_t);
int __ovld __cnfn get_image_height(read_write image2d_msaa_depth_t);
@@ -15825,18 +15863,22 @@ int __ovld __cnfn get_image_depth(read_write image3d_t);
#endif //defined(__opencl_c_read_write_images)
#endif // cl_khr_3d_image_writes
-// OpenCL Extension v2.0 s9.18 - Mipmaps
-#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+// OpenCL Extension - Mipmaps
+#if defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
#ifdef cl_khr_mipmap_image
/**
* Return the image miplevels.
*/
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_only image1d_t);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_only image2d_t);
int __ovld get_image_num_mip_levels(read_only image3d_t);
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(write_only image1d_t);
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(write_only image2d_t);
#ifdef cl_khr_3d_image_writes
int __ovld get_image_num_mip_levels(write_only image3d_t);
@@ -15850,31 +15892,37 @@ int __ovld get_image_num_mip_levels(read_write image3d_t);
#endif // cl_khr_3d_image_writes
#endif //defined(__opencl_c_read_write_images)
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_only image1d_array_t);
int __ovld get_image_num_mip_levels(read_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+#if defined(__opencl_depth_image_builtins)
int __ovld get_image_num_mip_levels(read_only image2d_array_depth_t);
int __ovld get_image_num_mip_levels(read_only image2d_depth_t);
-#endif // cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(write_only image1d_array_t);
int __ovld get_image_num_mip_levels(write_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+#if defined(__opencl_depth_image_builtins)
int __ovld get_image_num_mip_levels(write_only image2d_array_depth_t);
int __ovld get_image_num_mip_levels(write_only image2d_depth_t);
-#endif // cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(__opencl_c_read_write_images)
+#if __OPENCL_C_VERSION__ >= CL_VERSION_1_2
int __ovld get_image_num_mip_levels(read_write image1d_array_t);
int __ovld get_image_num_mip_levels(read_write image2d_array_t);
-#ifdef cl_khr_depth_images
+#endif // __OPENCL_C_VERSION__ >= CL_VERSION_1_2
+#if defined(__opencl_depth_image_builtins)
int __ovld get_image_num_mip_levels(read_write image2d_array_depth_t);
int __ovld get_image_num_mip_levels(read_write image2d_depth_t);
-#endif // cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#endif //defined(__opencl_c_read_write_images)
-#endif //cl_khr_mipmap_image
-#endif //defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_2_0)
+#endif // cl_khr_mipmap_image
+#endif // defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__)
/**
* Return the channel data type. Valid values are:
@@ -15901,10 +15949,10 @@ int __ovld __cnfn get_image_channel_data_type(read_only image2d_t);
int __ovld __cnfn get_image_channel_data_type(read_only image3d_t);
int __ovld __cnfn get_image_channel_data_type(read_only image1d_array_t);
int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_channel_data_type(read_only image2d_depth_t);
int __ovld __cnfn get_image_channel_data_type(read_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_data_type(read_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_data_type(read_only image2d_msaa_depth_t);
@@ -15920,10 +15968,10 @@ int __ovld __cnfn get_image_channel_data_type(write_only image3d_t);
#endif
int __ovld __cnfn get_image_channel_data_type(write_only image1d_array_t);
int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_channel_data_type(write_only image2d_depth_t);
int __ovld __cnfn get_image_channel_data_type(write_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_data_type(write_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_data_type(write_only image2d_msaa_depth_t);
@@ -15940,10 +15988,10 @@ int __ovld __cnfn get_image_channel_data_type(read_write image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_channel_data_type(read_write image1d_array_t);
int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_channel_data_type(read_write image2d_depth_t);
int __ovld __cnfn get_image_channel_data_type(read_write image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_t);
int __ovld __cnfn get_image_channel_data_type(read_write image2d_msaa_depth_t);
@@ -15975,10 +16023,10 @@ int __ovld __cnfn get_image_channel_order(read_only image2d_t);
int __ovld __cnfn get_image_channel_order(read_only image3d_t);
int __ovld __cnfn get_image_channel_order(read_only image1d_array_t);
int __ovld __cnfn get_image_channel_order(read_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_channel_order(read_only image2d_depth_t);
int __ovld __cnfn get_image_channel_order(read_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_order(read_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_order(read_only image2d_msaa_depth_t);
@@ -15994,10 +16042,10 @@ int __ovld __cnfn get_image_channel_order(write_only image3d_t);
#endif
int __ovld __cnfn get_image_channel_order(write_only image1d_array_t);
int __ovld __cnfn get_image_channel_order(write_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_channel_order(write_only image2d_depth_t);
int __ovld __cnfn get_image_channel_order(write_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_order(write_only image2d_msaa_t);
int __ovld __cnfn get_image_channel_order(write_only image2d_msaa_depth_t);
@@ -16014,10 +16062,10 @@ int __ovld __cnfn get_image_channel_order(read_write image3d_t);
#endif // cl_khr_3d_image_writes
int __ovld __cnfn get_image_channel_order(read_write image1d_array_t);
int __ovld __cnfn get_image_channel_order(read_write image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int __ovld __cnfn get_image_channel_order(read_write image2d_depth_t);
int __ovld __cnfn get_image_channel_order(read_write image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_t);
int __ovld __cnfn get_image_channel_order(read_write image2d_msaa_depth_t);
@@ -16033,10 +16081,10 @@ int __ovld __cnfn get_image_channel_order(read_write image2d_array_msaa_depth_t)
*/
int2 __ovld __cnfn get_image_dim(read_only image2d_t);
int2 __ovld __cnfn get_image_dim(read_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int2 __ovld __cnfn get_image_dim(read_only image2d_array_depth_t);
int2 __ovld __cnfn get_image_dim(read_only image2d_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int2 __ovld __cnfn get_image_dim(read_only image2d_msaa_t);
int2 __ovld __cnfn get_image_dim(read_only image2d_msaa_depth_t);
@@ -16046,10 +16094,10 @@ int2 __ovld __cnfn get_image_dim(read_only image2d_array_msaa_depth_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int2 __ovld __cnfn get_image_dim(write_only image2d_array_depth_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int2 __ovld __cnfn get_image_dim(write_only image2d_msaa_t);
int2 __ovld __cnfn get_image_dim(write_only image2d_msaa_depth_t);
@@ -16060,10 +16108,10 @@ int2 __ovld __cnfn get_image_dim(write_only image2d_array_msaa_depth_t);
#if defined(__opencl_c_read_write_images)
int2 __ovld __cnfn get_image_dim(read_write image2d_t);
int2 __ovld __cnfn get_image_dim(read_write image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
int2 __ovld __cnfn get_image_dim(read_write image2d_array_depth_t);
int2 __ovld __cnfn get_image_dim(read_write image2d_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_t);
int2 __ovld __cnfn get_image_dim(read_write image2d_msaa_depth_t);
@@ -16092,9 +16140,9 @@ int4 __ovld __cnfn get_image_dim(read_write image3d_t);
size_t __ovld __cnfn get_image_array_size(read_only image1d_array_t);
size_t __ovld __cnfn get_image_array_size(read_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
size_t __ovld __cnfn get_image_array_size(read_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
size_t __ovld __cnfn get_image_array_size(read_only image2d_array_msaa_t);
size_t __ovld __cnfn get_image_array_size(read_only image2d_array_msaa_depth_t);
@@ -16102,9 +16150,9 @@ size_t __ovld __cnfn get_image_array_size(read_only image2d_array_msaa_depth_t);
size_t __ovld __cnfn get_image_array_size(write_only image1d_array_t);
size_t __ovld __cnfn get_image_array_size(write_only image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
size_t __ovld __cnfn get_image_array_size(write_only image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_t);
size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_depth_t);
@@ -16113,9 +16161,9 @@ size_t __ovld __cnfn get_image_array_size(write_only image2d_array_msaa_depth_t)
#if defined(__opencl_c_read_write_images)
size_t __ovld __cnfn get_image_array_size(read_write image1d_array_t);
size_t __ovld __cnfn get_image_array_size(read_write image2d_array_t);
-#ifdef cl_khr_depth_images
+#if defined(__opencl_depth_image_builtins)
size_t __ovld __cnfn get_image_array_size(read_write image2d_array_depth_t);
-#endif //cl_khr_depth_images
+#endif // defined(__opencl_depth_image_builtins)
#if defined(cl_khr_gl_msaa_sharing)
size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_t);
size_t __ovld __cnfn get_image_array_size(read_write image2d_array_msaa_depth_t);
@@ -18685,4 +18733,5 @@ int __ovld arm_dot_acc_sat(char4, char4, int);
#undef __cnfn
#undef __ovld
+
#endif //_OPENCL_H_
diff --git a/clang/lib/Sema/OpenCLBuiltins.td b/clang/lib/Sema/OpenCLBuiltins.td
index 1e856e18b1a11..7fcfd4dfb41ed 100644
--- a/clang/lib/Sema/OpenCLBuiltins.td
+++ b/clang/lib/Sema/OpenCLBuiltins.td
@@ -250,7 +250,7 @@ class ImageType<Type _Ty, string _AccessQualifier> :
let Extension = !cond(
!and(!eq(_Ty.Name, "image3d_t"), !eq(_AccessQualifier, "WO")) : TypeExtension<"cl_khr_3d_image_writes">,
!and(!eq(_Ty.Name, "image3d_t"), !eq(_AccessQualifier, "RW")) : TypeExtension<"cl_khr_3d_image_writes __opencl_c_read_write_images">,
- !or(!eq(_Ty.Name, "image2d_depth_t"), !eq(_Ty.Name, "image2d_array_depth_t")) : TypeExtension<"cl_khr_depth_images">,
+ !or(!eq(_Ty.Name, "image2d_depth_t"), !eq(_Ty.Name, "image2d_array_depth_t")) : TypeExtension<"__opencl_depth_image_builtins">,
!eq(_AccessQualifier, "RW") : TypeExtension<"__opencl_c_read_write_images">,
true : _Ty.Extension);
}
diff --git a/clang/test/Headers/opencl-c-header.cl b/clang/test/Headers/opencl-c-header.cl
index e26f16827b20f..0be2efce28d2f 100644
--- a/clang/test/Headers/opencl-c-header.cl
+++ b/clang/test/Headers/opencl-c-header.cl
@@ -104,47 +104,130 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
#endif //__OPENCL_C_VERSION__
#pragma OPENCL EXTENSION cl_intel_planar_yuv : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
-#if cl_khr_subgroup_extended_types != 1
-#error "Incorrectly defined cl_khr_subgroup_extended_types"
+#if cl_khr_depth_images != 1
+#error "Incorrectly defined cl_khr_depth_images"
#endif
-#if cl_khr_subgroup_non_uniform_vote != 1
-#error "Incorrectly defined cl_khr_subgroup_non_uniform_vote"
+#if cl_khr_extended_bit_ops != 1
+#error "Incorrectly defined cl_khr_extended_bit_ops"
+#endif
+#if cl_ext_float_atomics != 1
+#error "Incorrectly defined cl_ext_float_atomics"
+#endif
+#if cl_khr_gl_msaa_sharing != 1
+#error "Incorrectly defined cl_khr_gl_msaa_sharing"
+#endif
+#if cl_khr_integer_dot_product != 1
+#error "Incorrectly defined cl_khr_integer_dot_product"
+#endif
+#if cl_khr_kernel_clock != 1
+#error "Incorrectly defined cl_khr_kernel_clock"
+#endif
+#if cl_khr_mipmap_image != 1
+#error "Incorrectly defined cl_khr_mipmap_image"
+#endif
+#if cl_khr_mipmap_image_writes != 1
+#error "Incorrectly defined cl_khr_mipmap_image_writes"
#endif
#if cl_khr_subgroup_ballot != 1
#error "Incorrectly defined cl_khr_subgroup_ballot"
#endif
+#if cl_khr_subgroup_clustered_reduce != 1
+#error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
+#endif
+#if cl_khr_subgroup_extended_types != 1
+#error "Incorrectly defined cl_khr_subgroup_extended_types"
+#endif
#if cl_khr_subgroup_non_uniform_arithmetic != 1
#error "Incorrectly defined cl_khr_subgroup_non_uniform_arithmetic"
#endif
-#if cl_khr_subgroup_shuffle != 1
-#error "Incorrectly defined cl_khr_subgroup_shuffle"
+#if cl_khr_subgroup_non_uniform_vote != 1
+#error "Incorrectly defined cl_khr_subgroup_non_uniform_vote"
+#endif
+#if cl_khr_subgroup_rotate != 1
+#error "Incorrectly defined cl_khr_subgroup_rotate"
#endif
#if cl_khr_subgroup_shuffle_relative != 1
#error "Incorrectly defined cl_khr_subgroup_shuffle_relative"
#endif
-#if cl_khr_subgroup_clustered_reduce != 1
-#error "Incorrectly defined cl_khr_subgroup_clustered_reduce"
+#if cl_khr_subgroup_shuffle != 1
+#error "Incorrectly defined cl_khr_subgroup_shuffle"
#endif
-#if cl_khr_subgroup_rotate != 1
-#error "Incorrectly defined cl_khr_subgroup_rotate"
+#if cl_khr_subgroups != 1
+#error "Incorrectly defined cl_khr_subgroups"
#endif
-#if cl_khr_extended_bit_ops != 1
-#error "Incorrectly defined cl_khr_extended_bit_ops"
+#if cl_khr_3d_image_writes != 1
+#error "Incorrectly defined cl_khr_3d_image_writes"
#endif
-#if cl_khr_integer_dot_product != 1
-#error "Incorrectly defined cl_khr_integer_dot_product"
+
+#else
+
+#ifdef cl_khr_depth_images
+#error "Incorrect cl_khr_depth_images define"
+#endif
+#ifdef cl_khr_extended_bit_ops
+#error "Incorrect cl_khr_extended_bit_ops define"
+#endif
+#ifdef cl_ext_float_atomics
+#error "Incorrect cl_ext_float_atomics define"
+#endif
+#ifdef cl_khr_gl_msaa_sharing
+#error "Incorrect cl_khr_gl_msaa_sharing define"
+#endif
+#ifdef cl_khr_integer_dot_product
+#error "Incorrect cl_khr_integer_dot_product define"
+#endif
+#ifdef cl_khr_kernel_clock
+#error "Incorrect cl_khr_kernel_clock define"
+#endif
+#ifdef cl_khr_mipmap_image
+#error "Incorrect cl_khr_mipmap_image define"
+#endif
+#ifdef cl_khr_mipmap_image_writes
+#error "Incorrect cl_khr_mipmap_image_writes define"
+#endif
+#ifdef cl_khr_subgroup_ballot
+#error "Incorrect cl_khr_subgroup_ballot define"
+#endif
+#ifdef cl_khr_subgroup_clustered_reduce
+#error "Incorrect cl_khr_subgroup_clustered_reduce define"
+#endif
+#ifdef cl_khr_subgroup_extended_types
+#error "Incorrect cl_khr_subgroup_extended_types define"
+#endif
+#ifdef cl_khr_subgroup_non_uniform_arithmetic
+#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
+#endif
+#ifdef cl_khr_subgroup_non_uniform_vote
+#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
+#endif
+#ifdef cl_khr_subgroup_rotate
+#error "Incorrect cl_khr_subgroup_rotate define"
+#endif
+#ifdef cl_khr_subgroup_shuffle_relative
+#error "Incorrect cl_khr_subgroup_shuffle_relative define"
#endif
+#ifdef cl_khr_subgroup_shuffle
+#error "Incorrect cl_khr_subgroup_shuffle define"
+#endif
+#ifdef cl_khr_subgroups
+#error "Incorrect cl_khr_subgroups define"
+#endif
+#ifdef cl_khr_3d_image_writes
+#error "Incorrect cl_khr_3d_image_writes define"
+#endif
+
+#endif // (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
+
+#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+
#if __opencl_c_integer_dot_product_input_4x8bit != 1
#error "Incorrectly defined __opencl_c_integer_dot_product_input_4x8bit"
#endif
#if __opencl_c_integer_dot_product_input_4x8bit_packed != 1
#error "Incorrectly defined __opencl_c_integer_dot_product_input_4x8bit_packed"
#endif
-#if cl_ext_float_atomics != 1
-#error "Incorrectly defined cl_ext_float_atomics"
-#endif
#if __opencl_c_ext_fp16_global_atomic_load_store != 1
#error "Incorrectly defined __opencl_c_ext_fp16_global_atomic_load_store"
#endif
@@ -199,45 +282,12 @@ global atomic_int z = ATOMIC_VAR_INIT(99);
#else
-#ifdef cl_khr_subgroup_extended_types
-#error "Incorrect cl_khr_subgroup_extended_types define"
-#endif
-#ifdef cl_khr_subgroup_non_uniform_vote
-#error "Incorrect cl_khr_subgroup_non_uniform_vote define"
-#endif
-#ifdef cl_khr_subgroup_ballot
-#error "Incorrect cl_khr_subgroup_ballot define"
-#endif
-#ifdef cl_khr_subgroup_non_uniform_arithmetic
-#error "Incorrect cl_khr_subgroup_non_uniform_arithmetic define"
-#endif
-#ifdef cl_khr_subgroup_shuffle
-#error "Incorrect cl_khr_subgroup_shuffle define"
-#endif
-#ifdef cl_khr_subgroup_shuffle_relative
-#error "Incorrect cl_khr_subgroup_shuffle_relative define"
-#endif
-#ifdef cl_khr_subgroup_clustered_reduce
-#error "Incorrect cl_khr_subgroup_clustered_reduce define"
-#endif
-#ifdef cl_khr_subgroup_rotate
-#error "Incorrect cl_khr_subgroup_rotate define"
-#endif
-#ifdef cl_khr_extended_bit_ops
-#error "Incorrect cl_khr_extended_bit_ops define"
-#endif
-#ifdef cl_khr_integer_dot_product
-#error "Incorrect cl_khr_integer_dot_product define"
-#endif
#ifdef __opencl_c_integer_dot_product_input_4x8bit
#error "Incorrect __opencl_c_integer_dot_product_input_4x8bit define"
#endif
#ifdef __opencl_c_integer_dot_product_input_4x8bit_packed
#error "Incorrect __opencl_c_integer_dot_product_input_4x8bit_packed define"
#endif
-#ifdef cl_ext_float_atomics
-#error "Incorrect cl_ext_float_atomics define"
-#endif
#ifdef __opencl_c_ext_fp16_global_atomic_load_store
#error "Incorrect __opencl_c_ext_fp16_global_atomic_load_store define"
#endif
diff --git a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
index 86b558530810e..ee33f86080e82 100644
--- a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
+++ b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -121,7 +121,7 @@
#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
// expected-warning at -1{{unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring}}
-#if (__OPENCL_C_VERSION__ >= 200)
+#if defined(__OPENCL_C_VERSION__)
#ifndef cl_khr_mipmap_image
#error "Missing cl_khr_mipmap_image define"
#endif
@@ -139,7 +139,7 @@
#pragma OPENCL EXTENSION cl_khr_srgb_image_writes: enable
// expected-warning at -1{{unsupported OpenCL extension 'cl_khr_srgb_image_writes' - ignoring}}
-#if (__OPENCL_C_VERSION__ >= 200)
+#if defined(__OPENCL_C_VERSION__)
#ifndef cl_khr_subgroups
#error "Missing cl_khr_subgroups define"
#endif
diff --git a/clang/test/SemaOpenCL/extension-version.cl b/clang/test/SemaOpenCL/extension-version.cl
index 85d7aac0e0f2a..b24c1b4bb6272 100644
--- a/clang/test/SemaOpenCL/extension-version.cl
+++ b/clang/test/SemaOpenCL/extension-version.cl
@@ -102,7 +102,7 @@
// expected-warning at -2{{OpenCL extension 'cl_khr_3d_image_writes' is core feature or supported optional core feature - ignoring}}
#endif
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 110)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cles_khr_int64
#error "Missing cles_khr_int64 define"
#endif
@@ -111,7 +111,7 @@
#endif
#pragma OPENCL EXTENSION cles_khr_int64 : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 100)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_gl_msaa_sharing
#error "Missing cl_khr_gl_msaa_sharing define"
#endif
@@ -120,7 +120,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_mipmap_image
#error "Missing cl_khr_mipmap_image define"
#endif
@@ -132,7 +132,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_mipmap_image : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_mipmap_image_writes
#error "Missing cl_khr_mipmap_image_writes define"
#endif
@@ -144,7 +144,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_mipmap_image_writes : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_srgb_image_writes
#error "Missing cl_khr_srgb_image_writes define"
#endif
@@ -153,7 +153,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_srgb_image_writes : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroups
#error "Missing cl_khr_subgroups define"
#endif
@@ -165,7 +165,7 @@
#endif
#pragma OPENCL EXTENSION cl_khr_subgroups : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_ext_float_atomics
#error "Missing cl_ext_float_atomics define"
#endif
@@ -177,7 +177,7 @@
// expected-warning at +1{{OpenCL extension 'cl_ext_float_atomics' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_ext_float_atomics : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_extended_bit_ops
#error "Missing cl_khr_extended_bit_ops define"
#endif
@@ -189,7 +189,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_extended_bit_ops' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_extended_bit_ops : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_integer_dot_product
#error "Missing cl_khr_integer_dot_product define"
#endif
@@ -201,7 +201,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_integer_dot_product' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_integer_dot_product : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_kernel_clock
#error "Missing cl_khr_kernel_clock define"
#endif
@@ -213,7 +213,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_kernel_clock' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_kernel_clock : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_ballot
#error "Missing cl_khr_subgroup_ballot define"
#endif
@@ -225,7 +225,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_ballot' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_ballot : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_clustered_reduce
#error "Missing cl_khr_subgroup_clustered_reduce define"
#endif
@@ -237,7 +237,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_clustered_reduce' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_clustered_reduce : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_extended_types
#error "Missing cl_khr_subgroup_extended_types define"
#endif
@@ -249,7 +249,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_extended_types' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_extended_types : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_named_barrier
#error "Missing cl_khr_subgroup_named_barrier define"
#endif
@@ -261,7 +261,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_named_barrier' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_named_barrier : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_non_uniform_arithmetic
#error "Missing cl_khr_subgroup_non_uniform_arithmetic define"
#endif
@@ -273,7 +273,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_non_uniform_arithmetic' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_arithmetic : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_non_uniform_vote
#error "Missing cl_khr_subgroup_non_uniform_vote define"
#endif
@@ -285,7 +285,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_non_uniform_vote' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_non_uniform_vote : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_rotate
#error "Missing cl_khr_subgroup_rotate define"
#endif
@@ -297,7 +297,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_rotate' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_rotate : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_shuffle_relative
#error "Missing cl_khr_subgroup_shuffle_relative define"
#endif
@@ -309,7 +309,7 @@
// expected-warning at +1{{OpenCL extension 'cl_khr_subgroup_shuffle_relative' unknown or does not require pragma - ignoring}}
#pragma OPENCL EXTENSION cl_khr_subgroup_shuffle_relative : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_subgroup_shuffle
#error "Missing cl_khr_subgroup_shuffle define"
#endif
@@ -331,7 +331,7 @@
#endif
#pragma OPENCL EXTENSION cl_amd_media_ops2 : enable
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 120)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#ifndef cl_khr_depth_images
#error "Missing cl_khr_depth_images define"
#endif
diff --git a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
index 8e0f8afcca985..7b499be136664 100644
--- a/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
+++ b/clang/test/SemaOpenCL/fdeclare-opencl-builtins.cl
@@ -73,7 +73,7 @@ typedef uint cl_mem_fence_flags;
typedef struct {int a;} ndrange_t;
// Enable extensions that are enabled in opencl-c-base.h.
-#if (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
+#if (defined(__OPENCL_CPP_VERSION__) || defined(__OPENCL_C_VERSION__))
#define __opencl_c_device_enqueue 1
#define __opencl_c_generic_address_space 1
#define cl_khr_subgroup_extended_types 1
@@ -82,6 +82,7 @@ typedef struct {int a;} ndrange_t;
#define cl_khr_subgroup_clustered_reduce 1
#define __opencl_c_read_write_images 1
#define __opencl_subgroup_builtins 1
+#define __opencl_depth_image_builtins 1
#endif
#if (__OPENCL_CPP_VERSION__ == 100 || __OPENCL_C_VERSION__ == 200)
@@ -300,9 +301,6 @@ kernel void basic_image_writeonly(write_only image1d_buffer_t image_write_only_i
int4 i4;
write_imagef(image3dwo, i4, i, f4);
-#if __OPENCL_C_VERSION__ <= CL_VERSION_1_2 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error at -2{{no matching function for call to 'write_imagef'}}
-#endif
}
kernel void basic_image_readwrite_depth(read_write image2d_depth_t image_read_write_image2d_depth) {
@@ -363,9 +361,6 @@ kernel void basic_image_write_readwrite_array_depth(read_write image2d_array_dep
kernel void basic_subgroup(global uint *out) {
out[0] = get_sub_group_size();
-#if __OPENCL_C_VERSION__ <= CL_VERSION_1_2 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error at -2{{use of undeclared identifier 'get_sub_group_size'}}
-#endif
// Only test when the base header is included, because we need the enum declarations.
#if !defined(NO_HEADER) && (defined(__OPENCL_CPP_VERSION__) || __OPENCL_C_VERSION__ >= 200)
@@ -373,17 +368,135 @@ kernel void basic_subgroup(global uint *out) {
#endif
}
+kernel void basic_image_readonly_depth(read_only image2d_depth_t image_read_only_image2d_depth) {
+ int2 i2;
+ float f;
+ float2 f2;
+ sampler_t sampler;
+ float resf;
+
+ resf = read_imagef(image_read_only_image2d_depth, sampler, f2);
+ resf = read_imagef(image_read_only_image2d_depth, sampler, i2);
+ resf = read_imagef(image_read_only_image2d_depth, sampler, f2, f);
+ resf = read_imagef(image_read_only_image2d_depth, sampler, f2, f2, f2);
+ resf = read_imagef(image_read_only_image2d_depth, sampler, i2);
+}
+
+kernel void basic_image_readonly_array_depth(read_only image2d_array_depth_t image_read_only_image2d_array_depth) {
+ int4 i4;
+ float f;
+ float2 f2;
+ float4 f4;
+ sampler_t sampler;
+ float resf;
+
+ resf = read_imagef(image_read_only_image2d_array_depth, sampler, f4);
+ resf = read_imagef(image_read_only_image2d_array_depth, sampler, i4);
+ resf = read_imagef(image_read_only_image2d_array_depth, sampler, f4, f);
+ resf = read_imagef(image_read_only_image2d_array_depth, sampler, f4, f2, f2);
+ resf = read_imagef(image_read_only_image2d_array_depth, sampler, i4);
+}
+
+kernel void basic_image_write_writeonly_depth(write_only image2d_depth_t image_write_only_image2d_depth) {
+ int i;
+ int2 i2;
+ float f;
+
+ write_imagef(image_write_only_image2d_depth, i2, f);
+ write_imagef(image_write_only_image2d_depth, i2, i, f);
+}
+
+kernel void basic_image_write_writeonly_array_depth(write_only image2d_array_depth_t image_write_only_image2d_array_depth) {
+ int i;
+ int4 i4;
+ float f;
+ float resf;
+
+ write_imagef(image_write_only_image2d_array_depth, i4, f);
+ write_imagef(image_write_only_image2d_array_depth, i4, i, f);
+}
+
+kernel void basic_image_query_read_only_depth(read_only image2d_depth_t image_read_only_image2d_depth, read_only image2d_array_depth_t image_read_only_image2d_array_depth) {
+ int i;
+ int2 i2;
+ i = get_image_width(image_read_only_image2d_depth);
+ i = get_image_width(image_read_only_image2d_array_depth);
+
+ i = get_image_height(image_read_only_image2d_depth);
+ i = get_image_height(image_read_only_image2d_array_depth);
+
+ i = get_image_num_mip_levels(image_read_only_image2d_depth);
+ i = get_image_num_mip_levels(image_read_only_image2d_array_depth);
+
+ i = get_image_channel_order(image_read_only_image2d_depth);
+ i = get_image_channel_order(image_read_only_image2d_array_depth);
+
+ i = get_image_channel_data_type(image_read_only_image2d_depth);
+ i = get_image_channel_data_type(image_read_only_image2d_array_depth);
+
+ i2 = get_image_dim(image_read_only_image2d_depth);
+ i2 = get_image_dim(image_read_only_image2d_array_depth);
+
+ size_t s = get_image_array_size(image_read_only_image2d_array_depth);
+}
+
+kernel void basic_image_query_write_only_depth(write_only image2d_depth_t image_write_only_image2d_depth, write_only image2d_array_depth_t image_write_only_image2d_array_depth) {
+ int i;
+ int2 i2;
+ i = get_image_width(image_write_only_image2d_depth);
+ i = get_image_width(image_write_only_image2d_array_depth);
+
+ i = get_image_height(image_write_only_image2d_depth);
+ i = get_image_height(image_write_only_image2d_array_depth);
+
+ i = get_image_num_mip_levels(image_write_only_image2d_depth);
+ i = get_image_num_mip_levels(image_write_only_image2d_array_depth);
+
+ i = get_image_channel_data_type(image_write_only_image2d_depth);
+ i = get_image_channel_data_type(image_write_only_image2d_array_depth);
+
+ i = get_image_channel_order(image_write_only_image2d_depth);
+ i = get_image_channel_order(image_write_only_image2d_array_depth);
+
+ i2 = get_image_dim(image_write_only_image2d_depth);
+ i2 = get_image_dim(image_write_only_image2d_array_depth);
+
+ size_t s = get_image_array_size(image_write_only_image2d_array_depth);
+}
+
+kernel void basic_image_query_read_write_depth(read_write image2d_depth_t image_read_write_image2d_depth, read_write image2d_array_depth_t image_read_write_image2d_array_depth) {
+#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
+ // expected-error at -2{{access qualifier 'read_write' cannot be used for '__read_write image2d_depth_t' prior to OpenCL C version 2.0 or in version 3.0 and without __opencl_c_read_write_images feature}}
+ // expected-error at -3{{access qualifier 'read_write' cannot be used for '__read_write image2d_array_depth_t' prior to OpenCL C version 2.0 or in version 3.0 and without __opencl_c_read_write_images feature}}
+#endif
+ int i;
+ int2 i2;
+ i = get_image_width(image_read_write_image2d_depth);
+ i = get_image_width(image_read_write_image2d_array_depth);
+
+ i = get_image_height(image_read_write_image2d_depth);
+ i = get_image_height(image_read_write_image2d_array_depth);
+
+ i = get_image_num_mip_levels(image_read_write_image2d_depth);
+ i = get_image_num_mip_levels(image_read_write_image2d_array_depth);
+
+ i = get_image_channel_data_type(image_read_write_image2d_depth);
+ i = get_image_channel_data_type(image_read_write_image2d_array_depth);
+
+ i = get_image_channel_order(image_read_write_image2d_depth);
+ i = get_image_channel_order(image_read_write_image2d_array_depth);
+
+ i2 = get_image_dim(image_read_write_image2d_depth);
+ i2 = get_image_dim(image_read_write_image2d_array_depth);
+
+ size_t s = get_image_array_size(image_read_write_image2d_array_depth);
+}
+
kernel void extended_subgroup(global uint4 *out, global int *scalar, global char2 *c2) {
out[0] = get_sub_group_eq_mask();
scalar[0] = sub_group_non_uniform_scan_inclusive_or(3);
scalar[1] = sub_group_clustered_reduce_logical_xor(2, 4);
*c2 = sub_group_broadcast(*c2, 2);
-#if __OPENCL_C_VERSION__ < CL_VERSION_2_0 && !defined(__OPENCL_CPP_VERSION__)
- // expected-error at -5{{use of undeclared identifier 'get_sub_group_eq_mask'}}
- // expected-error at -5{{use of undeclared identifier 'sub_group_non_uniform_scan_inclusive_or'}}
- // expected-error at -5{{use of undeclared identifier 'sub_group_clustered_reduce_logical_xor'}}
- // expected-error at -5{{use of undeclared identifier 'sub_group_broadcast'}}
-#endif
}
kernel void basic_vector_data(void) {
More information about the cfe-commits
mailing list