[clang] clang/AMDGPU: Add missing opencl feature macros (PR #170307)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 2 08:16:05 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-amdgpu
Author: Matt Arsenault (arsenm)
<details>
<summary>Changes</summary>
This is a partial fix for the rocm device-libs build. This
was most likely broken by 423bdb2bf257e19271d62e60b6339d84b8ce05aa
---
Full diff: https://github.com/llvm/llvm-project/pull/170307.diff
2 Files Affected:
- (modified) clang/lib/Basic/Targets/AMDGPU.h (+2)
- (modified) clang/test/Misc/amdgcn.languageOptsOpenCL.cl (+4)
``````````diff
diff --git a/clang/lib/Basic/Targets/AMDGPU.h b/clang/lib/Basic/Targets/AMDGPU.h
index a51d8d2375cfe..1d8f27ab915e2 100644
--- a/clang/lib/Basic/Targets/AMDGPU.h
+++ b/clang/lib/Basic/Targets/AMDGPU.h
@@ -316,8 +316,10 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
Opts["cl_amd_media_ops"] = true;
Opts["cl_amd_media_ops2"] = true;
+ // FIXME: Check subtarget for image support.
Opts["__opencl_c_images"] = true;
Opts["__opencl_c_3d_image_writes"] = true;
+ Opts["__opencl_c_read_write_images"] = true;
Opts["cl_khr_3d_image_writes"] = true;
Opts["__opencl_c_program_scope_global_variables"] = true;
Opts["__opencl_c_atomic_order_seq_cst"] = true;
diff --git a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
index 80c0825895c86..57ea891b3eb29 100644
--- a/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
+++ b/clang/test/Misc/amdgcn.languageOptsOpenCL.cl
@@ -162,6 +162,10 @@
#ifndef __opencl_c_program_scope_global_variables
#error "Missing __opencl_c_program_scope_global_variables define"
#endif
+
+ #ifndef __opencl_c_read_write_images
+ #error "Missing __opencl_c_read_write_images define"
+ #endif
#endif
#if (__OPENCL_C_VERSION__ >= 300)
``````````
</details>
https://github.com/llvm/llvm-project/pull/170307
More information about the cfe-commits
mailing list