Skip to content

[AMDGPU] Support the OpenCL generic addrspace feature by default #137636

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 2 commits into from
Apr 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions clang/lib/Basic/Targets/AMDGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,9 @@ class LLVM_LIBRARY_VISIBILITY AMDGPUTargetInfo final : public TargetInfo {
Opts["__opencl_c_images"] = true;
Opts["__opencl_c_3d_image_writes"] = true;
Opts["cl_khr_3d_image_writes"] = true;

Opts["__opencl_c_generic_address_space"] =
GPUKind >= llvm::AMDGPU::GK_GFX700;
}
}

Expand Down
8 changes: 8 additions & 0 deletions clang/test/Misc/amdgcn.languageOptsOpenCL.cl
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,11 @@
#endif
#pragma OPENCL EXTENSION cl_amd_media_ops2: enable

#if (__OPENCL_C_VERSION__ >= 300)
#ifndef __opencl_c_generic_address_space
#error "Missing __opencl_c_generic_address_space define"
#else
#error "Incorrect __opencl_c_generic_address_space define"
#endif
#pragma OPENCL EXTENSION __opencl_c_generic_address_space: enable
#endif
5 changes: 5 additions & 0 deletions clang/test/Misc/r600.languageOptsOpenCL.cl
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,8 @@
#pragma OPENCL EXTENSION cl_khr_subgroups: enable
// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_subgroups' - ignoring}}

#ifdef __opencl_c_generic_address_space
#error "Incorrect __opencl_c_generic_address_space define"
#endif
#pragma OPENCL EXTENSION __opencl_c_generic_address_space: enable
// expected-warning@-1{{OpenCL extension '__opencl_c_generic_address_space' unknown or does not require pragma - ignoring}}