[PATCH] D20389: NVPTX: Add supported CL features

Jan Vesely via cfe-commits cfe-commits at lists.llvm.org
Fri May 27 15:35:36 PDT 2016


jvesely updated the summary for this revision.
jvesely added a subscriber: cfe-commits.
jvesely updated this revision to Diff 58849.
jvesely added a comment.

Report only clinfo exported extensions.


Repository:
  rL LLVM

http://reviews.llvm.org/D20389

Files:
  lib/Basic/Targets.cpp
  test/Misc/nvptx.languageOptsOpenCL.cl

Index: test/Misc/nvptx.languageOptsOpenCL.cl
===================================================================
--- /dev/null
+++ test/Misc/nvptx.languageOptsOpenCL.cl
@@ -0,0 +1,55 @@
+// REQUIRES: nvptx-registered-target
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple nvptx64-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple nvptx64-unknown-unknown
+// expected-no-diagnostics
+
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#if (__OPENCL_C_VERSION__ < 120)
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+
+#if (__OPENCL_C_VERSION__ == 100)
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+#endif
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+#endif
Index: lib/Basic/Targets.cpp
===================================================================
--- lib/Basic/Targets.cpp
+++ lib/Basic/Targets.cpp
@@ -1862,6 +1862,19 @@
 
     return GPU != GK_NONE;
   }
+  void setSupportedOpenCLOpts() override {
+    auto &Opts = getSupportedOpenCLOpts();
+    Opts.cl_clang_storage_class_specifiers = 1;
+    Opts.cl_khr_gl_sharing = 1;
+    Opts.cl_khr_icd = 1;
+
+    Opts.cl_khr_fp64 = 1;
+    Opts.cl_khr_byte_addressable_store = 1;
+    Opts.cl_khr_global_int32_base_atomics = 1;
+    Opts.cl_khr_global_int32_extended_atomics = 1;
+    Opts.cl_khr_local_int32_base_atomics = 1;
+    Opts.cl_khr_local_int32_extended_atomics = 1;
+  }
 };
 
 const Builtin::Info NVPTXTargetInfo::BuiltinInfo[] = {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20389.58849.patch
Type: text/x-patch
Size: 2930 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160527/829e3789/attachment.bin>


More information about the cfe-commits mailing list