Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 5 additions & 2 deletions clang/lib/Basic/Targets/AMDGPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,12 @@ 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_program_scope_global_variables"] = true;

Opts["__opencl_c_generic_address_space"] =
GPUKind >= llvm::AMDGPU::GK_GFX700;
if (GPUKind >= llvm::AMDGPU::GK_GFX700) {
Opts["__opencl_c_generic_address_space"] = true;
Opts["__opencl_c_device_enqueue"] = true;
}
}
}

Expand Down
34 changes: 29 additions & 5 deletions clang/test/Misc/amdgcn.languageOptsOpenCL.cl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES

// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple amdgcn-unknown-unknown -Wpedantic-core-features -DTEST_CORE_FEATURES
// RUN: %clang_cc1 -x cl -cl-std=CL3.0 %s -verify -triple amdgcn-unknown-unknown -target-cpu gfx700 -Wpedantic-core-features -DTEST_CORE_FEATURES -DFLAT_SUPPORT

// Extensions in all versions
#ifndef cl_clang_storage_class_specifiers
#error "Missing cl_clang_storage_class_specifiers define"
Expand Down Expand Up @@ -156,10 +159,31 @@
#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"
#ifndef __opencl_c_program_scope_global_variables
#error "Missing __opencl_c_program_scope_global_variables define"
#endif
#endif
#pragma OPENCL EXTENSION __opencl_c_generic_address_space: enable

#if (__OPENCL_C_VERSION__ >= 300)
#ifdef FLAT_SUPPORT
#ifndef __opencl_c_generic_address_space
#error "Missing __opencl_c_generic_address_space define"
#endif
#else
#ifdef __opencl_c_generic_address_space
#error "Incorrect __opencl_c_atomic_scope_all_devices define"
#endif
#endif
#endif

#if (__OPENCL_C_VERSION__ >= 300)
#ifdef FLAT_SUPPORT
#ifndef __opencl_c_device_enqueue
#error "Missing __opencl_c_device_enqueue define"
#endif
#else
#ifdef __opencl_c_device_enqueue
#error "Incorrect __opencl_c_device_enqueue define"
#endif
#endif
#endif