-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[NVPTX] Enable OpenCL 3d_image_writes support #143331
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
base: main
Are you sure you want to change the base?
Conversation
NV supports opencl_3d_image_writes according https://developer.nvidia.com/blog/nvidia-is-now-opencl-3-0-conformant/ This PR allows removing explicit enabling of image extensions via -cl-ext command line option, e.g. at https://github.com/intel/llvm/blob/43b3d42e2b2060e9e9e3a96469a1982dc4c10ddd/libclc/CMakeLists.txt#L503
@llvm/pr-subscribers-clang Author: Wenju He (wenju-he) ChangesNV supports opencl_3d_image_writes according This PR allows removing explicit enabling of image extensions via -cl-ext command line option, e.g. at Full diff: https://github.com/llvm/llvm-project/pull/143331.diff 3 Files Affected:
diff --git a/clang/lib/Basic/Targets/NVPTX.h b/clang/lib/Basic/Targets/NVPTX.h
index 33c29586359be..ae36252601229 100644
--- a/clang/lib/Basic/Targets/NVPTX.h
+++ b/clang/lib/Basic/Targets/NVPTX.h
@@ -172,6 +172,10 @@ class LLVM_LIBRARY_VISIBILITY NVPTXTargetInfo : public TargetInfo {
Opts["cl_khr_local_int32_base_atomics"] = true;
Opts["cl_khr_local_int32_extended_atomics"] = true;
+ 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"] = true;
}
diff --git a/clang/test/Misc/nvptx.languageOptsOpenCL.cl b/clang/test/Misc/nvptx.languageOptsOpenCL.cl
index 2610cfafc257b..186f22782d010 100644
--- a/clang/test/Misc/nvptx.languageOptsOpenCL.cl
+++ b/clang/test/Misc/nvptx.languageOptsOpenCL.cl
@@ -108,11 +108,10 @@
#endif
// Core feature in CL 2.0, but not supported on nvptx
-#ifdef cl_khr_3d_image_writes
-#error "Incorrect cl_khr_3d_image_writes define"
+#ifndef cl_khr_3d_image_writes
+#error "Missing cl_khr_3d_image_writes define"
#endif
#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
-// expected-warning@-1{{unsupported OpenCL extension 'cl_khr_3d_image_writes' - ignoring}}
#ifdef cl_khr_gl_msaa_sharing
#error "Incorrect cl_khr_gl_msaa_sharing define"
diff --git a/clang/test/Misc/nvptx.unsupported_core.cl b/clang/test/Misc/nvptx.unsupported_core.cl
deleted file mode 100644
index b56a4828914ee..0000000000000
--- a/clang/test/Misc/nvptx.unsupported_core.cl
+++ /dev/null
@@ -1,7 +0,0 @@
-// RUN: %clang_cc1 -cl-std=CL2.0 -triple nvptx-unknown-unknown -Wpedantic-core-features %s 2> %t
-// RUN: FileCheck --check-prefixes=CHECK-C < %t %s
-// RUN: %clang_cc1 -cl-std=CLC++ -triple nvptx-unknown-unknown -Wpedantic-core-features %s 2> %t
-// RUN: FileCheck --check-prefixes=CHECK-CPP < %t %s
-
-// CHECK-C: cl_khr_3d_image_writes is a core feature in OpenCL C version 2.0 but not supported on this target
-// CHECK-CPP: cl_khr_3d_image_writes is a core feature in C++ for OpenCL version 1.0 but not supported on this target
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@svenvh appears to be the current maintainer of OpenCL in LLVM. |
This is target specific; perhaps @modiking could review or knows who could review this? |
NV supports opencl_3d_image_writes according
https://developer.nvidia.com/blog/nvidia-is-now-opencl-3-0-conformant/
This PR allows removing explicit enabling of image extensions via -cl-ext command line option, e.g. at
https://github.com/intel/llvm/blob/43b3d42e2b2060e9e9e3a96469a1982dc4c10ddd/libclc/CMakeLists.txt#L503