Skip to content

[Clang][OpenCL] Wrap image functions with the macro #129177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 4, 2025

Conversation

vmustya
Copy link
Contributor

@vmustya vmustya commented Feb 28, 2025

According to the OpenCL C spec, the image functions are optional.
For OpenCL C 1.2, the image functions are guarded by the
__IMAGE_SUPPORT__ macro. For the OpenCL C 3.0 and later, the
__opencl_c_images macro is used.

According to the OpenCL C spec, the image functions are optional.
For OpenCL C 1.2, the image functions are guarded by the
`__IMAGE_SUPPORT__` macro. For the OpenCL C 3.0 and later, the
`__opencl_c_images` macro is used.
@llvmbot llvmbot added clang Clang issues not falling into any other category backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics labels Feb 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 28, 2025

@llvm/pr-subscribers-backend-x86

Author: Victor Mustya (vmustya)

Changes

According to the OpenCL C spec, the image functions are optional.
For OpenCL C 1.2, the image functions are guarded by the
__IMAGE_SUPPORT__ macro. For the OpenCL C 3.0 and later, the
__opencl_c_images macro is used.


Full diff: https://github.com/llvm/llvm-project/pull/129177.diff

1 Files Affected:

  • (modified) clang/lib/Headers/opencl-c.h (+3)
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 20719b74b6b8d..8d8ef497cec49 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -15082,6 +15082,7 @@ half16 __ovld __cnfn shuffle2(half16, half16, ushort16);
 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
 #endif //cl_khr_gl_msaa_sharing
 
+#if (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
 /**
  * Use the coordinate (coord.xy) to do an element lookup in
  * the 2D image object specified by image.
@@ -16143,6 +16144,8 @@ int __ovld __cnfn get_image_num_samples(read_write image2d_array_msaa_depth_t);
 #endif //defined(__opencl_c_read_write_images)
 #endif
 
+#endif // (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
+
 // OpenCL v2.0 s6.13.15 - Work-group Functions
 
 #if defined(__opencl_c_work_group_collective_functions)

@llvmbot
Copy link
Member

llvmbot commented Feb 28, 2025

@llvm/pr-subscribers-clang

Author: Victor Mustya (vmustya)

Changes

According to the OpenCL C spec, the image functions are optional.
For OpenCL C 1.2, the image functions are guarded by the
__IMAGE_SUPPORT__ macro. For the OpenCL C 3.0 and later, the
__opencl_c_images macro is used.


Full diff: https://github.com/llvm/llvm-project/pull/129177.diff

1 Files Affected:

  • (modified) clang/lib/Headers/opencl-c.h (+3)
diff --git a/clang/lib/Headers/opencl-c.h b/clang/lib/Headers/opencl-c.h
index 20719b74b6b8d..8d8ef497cec49 100644
--- a/clang/lib/Headers/opencl-c.h
+++ b/clang/lib/Headers/opencl-c.h
@@ -15082,6 +15082,7 @@ half16 __ovld __cnfn shuffle2(half16, half16, ushort16);
 #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing : enable
 #endif //cl_khr_gl_msaa_sharing
 
+#if (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
 /**
  * Use the coordinate (coord.xy) to do an element lookup in
  * the 2D image object specified by image.
@@ -16143,6 +16144,8 @@ int __ovld __cnfn get_image_num_samples(read_write image2d_array_msaa_depth_t);
 #endif //defined(__opencl_c_read_write_images)
 #endif
 
+#endif // (defined(__opencl_c_images) || defined(__IMAGE_SUPPORT__))
+
 // OpenCL v2.0 s6.13.15 - Work-group Functions
 
 #if defined(__opencl_c_work_group_collective_functions)

@michalpaszkowski michalpaszkowski requested a review from svenvh March 2, 2025 06:36
@michalpaszkowski
Copy link
Member

Hi @svenvh! I am adding you as a reviewer since you worked on the headers earlier.

@michalpaszkowski michalpaszkowski merged commit c1aebd4 into llvm:main Mar 4, 2025
15 checks passed
@vmustya vmustya deleted the opencl-c-header-image-optional branch March 4, 2025 00:59
jph-13 pushed a commit to jph-13/llvm-project that referenced this pull request Mar 21, 2025
According to the OpenCL C spec, the image functions are optional.
For OpenCL C 1.2, the image functions are guarded by the
`__IMAGE_SUPPORT__` macro. For the OpenCL C 3.0 and later, the
`__opencl_c_images` macro is used.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:X86 clang:headers Headers provided by Clang, e.g. for intrinsics clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants