[clang] clang/AMDGPU: Add missing opencl feature macros (PR #170307)
Matt Arsenault via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 2 08:21:28 PST 2025
https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/170307
>From afb198acbcd2fe72ba0f373daf988263f7d8150b Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Tue, 2 Dec 2025 09:33:27 -0500
Subject: [PATCH] clang/AMDGPU: Add missing opencl feature macros
This is a partial fix for the rocm device-libs build. This
was most likely broken by 423bdb2bf257e19271d62e60b6339d84b8ce05aa
---
clang/lib/Basic/Targets/AMDGPU.h | 2 ++
clang/test/Misc/amdgcn.languageOptsOpenCL.cl | 4 ++++
2 files changed, 6 insertions(+)
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)
More information about the cfe-commits
mailing list