Skip to content

Conversation

@vmustya
Copy link
Contributor

@vmustya vmustya commented Feb 28, 2025

According to the OpenCL C 3.0 spec, the image functions are optional.
If they are supported, the __opencl_c_images macro is defined. This
patch wraps the image functions with the macro. Without the wrapping,
the frontend emit errors, when a user tries to disable the images
support.

According to the OpenCL C 3.0 spec, the image functions are optional.
If they are supported, the `__opencl_c_images` macro is defined. This
patch wraps the image functions with the macro. Without the wrapping,
the frontend emit errors, when a user tries to disable the images
support.
@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-clang

Author: Victor Mustya (vmustya)

Changes

According to the OpenCL C 3.0 spec, the image functions are optional.
If they are supported, the __opencl_c_images macro is defined. This
patch wraps the image functions with the macro. Without the wrapping,
the frontend emit errors, when a user tries to disable the images
support.


Full diff: https://github.com/llvm/llvm-project/pull/129171.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..d77cf3c7b2faa 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)
 /**
  * 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)
+
 // 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-backend-x86

Author: Victor Mustya (vmustya)

Changes

According to the OpenCL C 3.0 spec, the image functions are optional.
If they are supported, the __opencl_c_images macro is defined. This
patch wraps the image functions with the macro. Without the wrapping,
the frontend emit errors, when a user tries to disable the images
support.


Full diff: https://github.com/llvm/llvm-project/pull/129171.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..d77cf3c7b2faa 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)
 /**
  * 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)
+
 // OpenCL v2.0 s6.13.15 - Work-group Functions
 
 #if defined(__opencl_c_work_group_collective_functions)

@vmustya vmustya closed this Feb 28, 2025
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.

2 participants