Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Jan Vesely via cfe-commits
This revision was automatically updated to reflect the committed changes.
jvesely marked 5 inline comments as done.
Closed by commit rL271413: Fixup list of available extensions (authored by 
jvesely).

Changed prior to commit:
  http://reviews.llvm.org/D20447?vs=59240=59254#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D20447

Files:
  cfe/trunk/include/clang/Basic/OpenCLExtensions.def
  cfe/trunk/test/SemaOpenCL/extension-version.cl

Index: cfe/trunk/include/clang/Basic/OpenCLExtensions.def
===
--- cfe/trunk/include/clang/Basic/OpenCLExtensions.def
+++ cfe/trunk/include/clang/Basic/OpenCLExtensions.def
@@ -34,35 +34,39 @@
 #endif // OPENCLEXT_INTERNAL
 
 // OpenCL 1.0.
-OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 120)
+OPENCLEXT_INTERNAL(cl_khr_3d_image_writes, 100, 200)
+// fprounding mode is special since it is not mentioned beyond 1.0
+OPENCLEXT_INTERNAL(cl_khr_select_fprounding_mode, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_byte_addressable_store, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_fp16, 100, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_fp64, 100, 120)
 OPENCLEXT_INTERNAL(cl_khr_global_int32_base_atomics, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_global_int32_extended_atomics, 100, 110)
-OPENCLEXT_INTERNAL(cl_khr_gl_sharing, 100, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_icd, 100, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_local_int32_base_atomics, 100, 110)
 OPENCLEXT_INTERNAL(cl_khr_local_int32_extended_atomics, 100, 110)
+OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_gl_sharing, 100, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_icd, 100, ~0U)
 
 // OpenCL 1.1.
-OPENCLEXT_INTERNAL(cl_khr_d3d10_sharing, 110, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_gl_event, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_base_atomics, 110, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_int64_extended_atomics, 110, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_d3d10_sharing, 110, ~0U)
 
 // OpenCL 1.2.
+OPENCLEXT_INTERNAL(cl_khr_context_abort, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_d3d11_sharing, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_depth_images, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_dx9_media_sharing, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_image2d_from_buffer, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_initialize_memory, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_gl_depth_images, 120, ~0U)
+OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 120, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_spir, 120, ~0U)
 
 // OpenCL 2.0.
 OPENCLEXT_INTERNAL(cl_khr_egl_event, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_egl_image, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_gl_msaa_sharing, 200, ~0U)
-OPENCLEXT_INTERNAL(cl_khr_initialize_memory, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_srgb_image_writes, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_subgroups, 200, ~0U)
 OPENCLEXT_INTERNAL(cl_khr_terminate_context, 200, ~0U)
Index: cfe/trunk/test/SemaOpenCL/extension-version.cl
===
--- cfe/trunk/test/SemaOpenCL/extension-version.cl
+++ cfe/trunk/test/SemaOpenCL/extension-version.cl
@@ -0,0 +1,225 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+
+#if __OPENCL_C_VERSION__ >= 200
+// expected-no-diagnostics
+#endif
+
+// Extensions in all versions
+#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_fp16
+#error "Missing cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef 

Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Anastasia Stulova via cfe-commits
Anastasia accepted this revision.
Anastasia added a comment.
This revision is now accepted and ready to land.

LGTM! Thanks!


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Jan Vesely via cfe-commits
jvesely updated this revision to Diff 59240.
jvesely added a comment.

Fix typo: COre -> Core


Repository:
  rL LLVM

http://reviews.llvm.org/D20447

Files:
  include/clang/Basic/OpenCLExtensions.def
  test/SemaOpenCL/extension-version.cl

Index: test/SemaOpenCL/extension-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/extension-version.cl
@@ -0,0 +1,225 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+
+#if __OPENCL_C_VERSION__ >= 200
+// expected-no-diagnostics
+#endif
+
+// Extensions in all versions
+#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_fp16
+#error "Missing cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// Core features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+
+#ifndef cl_khr_select_fprounding_mode
+#error "Missing cl_khr_select_fp_rounding_mode define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable
+
+#endif
+
+// Core feature in CL 1.2
+#if (__OPENCL_C_VERSION__ < 120)
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+//Core feature in CL 2.0
+#if (__OPENCL_C_VERSION__ < 200)
+#ifndef cl_khr_3d_image_writes
+#error "Missing cl_khr_3d_image_writes define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
+#endif
+
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_gl_event
+#error "Missing cl_khr_gl_event define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_event: enable
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_d3d10_sharing
+#error "Missing cl_khr_d3d10_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_context_abort
+#error "Missing cl_context_abort define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_context_abort: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_d3d11_sharing
+#error "Missing cl_khr_d3d11_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d11_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_dx9_media_sharing
+#error "Missing cl_khr_dx9_media_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_image2d_from_buffer
+#error "Missing cl_khr_image2d_from_buffer define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef 

Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:73
@@ +72,3 @@
+
+#endif
+

jvesely wrote:
> Anastasia wrote:
> > Could you put a comment to make it more readable, something like 
> > 
> > #endif // (__OPENCL_C_VERSION__ < 110)
> These large blocks get broken into ~7 line pieces, in D20744. Do you still 
> want the endif comments there, or should I add the comments here and remove 
> them in D20744?
Ok, no problem. Let's just leave it as is. I guess the other change will be 
committed soon. :)


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Jan Vesely via cfe-commits
jvesely marked 2 inline comments as done.


Comment at: test/SemaOpenCL/extension-version.cl:73
@@ +72,3 @@
+
+#endif
+

Anastasia wrote:
> Could you put a comment to make it more readable, something like 
> 
> #endif // (__OPENCL_C_VERSION__ < 110)
These large blocks get broken into ~7 line pieces, in D20744. Do you still want 
the endif comments there, or should I add the comments here and remove them in 
D20744?


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:41
@@ +40,3 @@
+
+// COre features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)

COre -> core


Comment at: test/SemaOpenCL/extension-version.cl:73
@@ +72,3 @@
+
+#endif
+

Could you put a comment to make it more readable, something like 

#endif // (__OPENCL_C_VERSION__ < 110)


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-06-01 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:41
@@ +40,3 @@
+
+// COre features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)

Anastasia wrote:
> COre -> core
Actually looking at other comments -> Core


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Jan Vesely via cfe-commits
jvesely marked 7 inline comments as done.


Comment at: test/SemaOpenCL/extension-version.cl:12
@@ +11,3 @@
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif

arsenm wrote:
> When the AMD compiler added these warnings a long time ago I found them 
> obnoxious and required adding more complicated ifdef combinations to silence 
> them
moved to D20744


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Matt Arsenault via cfe-commits
arsenm added a subscriber: arsenm.


Comment at: test/SemaOpenCL/extension-version.cl:12
@@ +11,3 @@
+#ifndef cl_clang_storage_class_specifiers
+#error "Missing cl_clang_storage_class_specifiers define"
+#endif

When the AMD compiler added these warnings a long time ago I found them 
obnoxious and required adding more complicated ifdef combinations to silence 
them


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Jan Vesely via cfe-commits
jvesely updated this revision to Diff 58806.
jvesely added a comment.

add detection of extensions in early CL versions to test.


Repository:
  rL LLVM

http://reviews.llvm.org/D20447

Files:
  include/clang/Basic/OpenCLExtensions.def
  test/SemaOpenCL/extension-version.cl

Index: test/SemaOpenCL/extension-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/extension-version.cl
@@ -0,0 +1,225 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+
+#if __OPENCL_C_VERSION__ >= 200
+// expected-no-diagnostics
+#endif
+
+// Extensions in all versions
+#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_fp16
+#error "Missing cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// COre features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+
+#ifndef cl_khr_select_fprounding_mode
+#error "Missing cl_khr_select_fp_rounding_mode define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable
+
+#endif
+
+// Core feature in CL 1.2
+#if (__OPENCL_C_VERSION__ < 120)
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+//Core feature in CL 2.0
+#if (__OPENCL_C_VERSION__ < 200)
+#ifndef cl_khr_3d_image_writes
+#error "Missing cl_khr_3d_image_writes define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
+#endif
+
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_gl_event
+#error "Missing cl_khr_gl_event define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_gl_event' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_event: enable
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_d3d10_sharing
+#error "Missing cl_khr_d3d10_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d10_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_context_abort
+#error "Missing cl_context_abort define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_context_abort' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_context_abort: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_d3d11_sharing
+#error "Missing cl_khr_d3d11_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_d3d11_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d11_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_dx9_media_sharing
+#error "Missing cl_khr_dx9_media_sharing define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_dx9_media_sharing' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_image2d_from_buffer
+#error "Missing cl_khr_image2d_from_buffer define"
+#endif
+#else
+// expected-warning@+2{{unsupported OpenCL extension 'cl_khr_image2d_from_buffer' - ignoring}}
+#endif
+#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable
+
+#if 

Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-27 Thread Yaxun Liu via cfe-commits
yaxunl added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:11
@@ +10,3 @@
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+

Anastasia wrote:
> jvesely wrote:
> > Anastasia wrote:
> > > jvesely wrote:
> > > > Anastasia wrote:
> > > > > Could you use standard diagnostic check please:
> > > > >   expected-warning{{unknown OpenCL extension ...
> > > > > 
> > > > > Similarly to SemaOpenCL/extensions.cl
> > > > not sure I follow, the test does not trigger any diagnostics (by 
> > > > design).
> > > > are you saying that I should introduce negative checks to make sure 
> > > > extensions are not available outside of their respective context?
> > > > Is there a way to filter verifier tags based on clang invocation? 
> > > > (something like FileCheck prefix)
> > > Exactly, you should check that the extensions are enabled correctly based 
> > > on CL versions.
> > > 
> > > For example if you compile this without passing -cl-std=CL1.2:
> > >   #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
> > > the following error is produced:
> > >   unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring
> > > 
> > > You can condition error directives on CL version passed as it's done in 
> > > the example test SemaOpenCL/extensions.cl.
> > > 
> > > So what is the original intension of this tests? Not sure I understand 
> > > what you are trying to test.
> > it's a positive test that checks that extensions are available (both that 
> > the define is present, and that #pragma passes without error).
> > 
> > I did not include negative tests (check that extension is not available 
> > outside of its respective context), because I think it's a bit overzealous 
> > reading of the specs.
> > For example cl_khr_d3d10_sharing is first mentioned in OpenCL 1.1 specs, 
> > but the text of the extension says that it is written against OpenCL 1.0.48 
> > spec. (I moved cl_khr_icd to 1.0 for the same reason). I think if a vendor 
> > can add vendor specific extensions to the list of supported extensions, it 
> > should be possible to add extensions from higher CL versions.
> > 
> > similarly, I would argue against warnings for extensions promoted to core 
> > features (or at least hide the warning behind -pedantic). they are listed 
> > in CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to 
> > allow pragmas in higher CLC versions for backward compatibility.
> I agree with this:
>   "similarly, I would argue against warnings for extensions promoted to core 
> features (or at least hide the warning behind -pedantic). they are listed in 
> CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow 
> pragmas in higher CLC versions for backward compatibility."
> 
> @yaxunl, what's your opinion here?
> 
> Regarding the test, I think we should still check the diagnostics being given 
> correctly especially for the extensions unavailable in the earlier versions. 
> It should be quite straight forward to extend this test.
The warning is a reminder that this is no longer an extension and the user 
should remove that. However I do not have strong opinion on that.


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-25 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:11
@@ +10,3 @@
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+

jvesely wrote:
> Anastasia wrote:
> > jvesely wrote:
> > > Anastasia wrote:
> > > > Could you use standard diagnostic check please:
> > > >   expected-warning{{unknown OpenCL extension ...
> > > > 
> > > > Similarly to SemaOpenCL/extensions.cl
> > > not sure I follow, the test does not trigger any diagnostics (by design).
> > > are you saying that I should introduce negative checks to make sure 
> > > extensions are not available outside of their respective context?
> > > Is there a way to filter verifier tags based on clang invocation? 
> > > (something like FileCheck prefix)
> > Exactly, you should check that the extensions are enabled correctly based 
> > on CL versions.
> > 
> > For example if you compile this without passing -cl-std=CL1.2:
> >   #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
> > the following error is produced:
> >   unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring
> > 
> > You can condition error directives on CL version passed as it's done in the 
> > example test SemaOpenCL/extensions.cl.
> > 
> > So what is the original intension of this tests? Not sure I understand what 
> > you are trying to test.
> it's a positive test that checks that extensions are available (both that the 
> define is present, and that #pragma passes without error).
> 
> I did not include negative tests (check that extension is not available 
> outside of its respective context), because I think it's a bit overzealous 
> reading of the specs.
> For example cl_khr_d3d10_sharing is first mentioned in OpenCL 1.1 specs, but 
> the text of the extension says that it is written against OpenCL 1.0.48 spec. 
> (I moved cl_khr_icd to 1.0 for the same reason). I think if a vendor can add 
> vendor specific extensions to the list of supported extensions, it should be 
> possible to add extensions from higher CL versions.
> 
> similarly, I would argue against warnings for extensions promoted to core 
> features (or at least hide the warning behind -pedantic). they are listed in 
> CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow 
> pragmas in higher CLC versions for backward compatibility.
I agree with this:
  "similarly, I would argue against warnings for extensions promoted to core 
features (or at least hide the warning behind -pedantic). they are listed in 
CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow 
pragmas in higher CLC versions for backward compatibility."

@yaxunl, what's your opinion here?

Regarding the test, I think we should still check the diagnostics being given 
correctly especially for the extensions unavailable in the earlier versions. It 
should be quite straight forward to extend this test.


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-24 Thread Jan Vesely via cfe-commits
jvesely added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:11
@@ +10,3 @@
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+

Anastasia wrote:
> jvesely wrote:
> > Anastasia wrote:
> > > Could you use standard diagnostic check please:
> > >   expected-warning{{unknown OpenCL extension ...
> > > 
> > > Similarly to SemaOpenCL/extensions.cl
> > not sure I follow, the test does not trigger any diagnostics (by design).
> > are you saying that I should introduce negative checks to make sure 
> > extensions are not available outside of their respective context?
> > Is there a way to filter verifier tags based on clang invocation? 
> > (something like FileCheck prefix)
> Exactly, you should check that the extensions are enabled correctly based on 
> CL versions.
> 
> For example if you compile this without passing -cl-std=CL1.2:
>   #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
> the following error is produced:
>   unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring
> 
> You can condition error directives on CL version passed as it's done in the 
> example test SemaOpenCL/extensions.cl.
> 
> So what is the original intension of this tests? Not sure I understand what 
> you are trying to test.
it's a positive test that checks that extensions are available (both that the 
define is present, and that #pragma passes without error).

I did not include negative tests (check that extension is not available outside 
of its respective context), because I think it's a bit overzealous reading of 
the specs.
For example cl_khr_d3d10_sharing is first mentioned in OpenCL 1.1 specs, but 
the text of the extension says that it is written against OpenCL 1.0.48 spec. 
(I moved cl_khr_icd to 1.0 for the same reason). I think if a vendor can add 
vendor specific extensions to the list of supported extensions, it should be 
possible to add extensions from higher CL versions.

similarly, I would argue against warnings for extensions promoted to core 
features (or at least hide the warning behind -pedantic). they are listed in 
CL_DEVICE_EXTENSIONS for backwards compatibility so I'd say it is OK to allow 
pragmas in higher CLC versions for backward compatibility.


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-24 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:11
@@ +10,3 @@
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+

jvesely wrote:
> Anastasia wrote:
> > Could you use standard diagnostic check please:
> >   expected-warning{{unknown OpenCL extension ...
> > 
> > Similarly to SemaOpenCL/extensions.cl
> not sure I follow, the test does not trigger any diagnostics (by design).
> are you saying that I should introduce negative checks to make sure 
> extensions are not available outside of their respective context?
> Is there a way to filter verifier tags based on clang invocation? (something 
> like FileCheck prefix)
Exactly, you should check that the extensions are enabled correctly based on CL 
versions.

For example if you compile this without passing -cl-std=CL1.2:
  #pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
the following error is produced:
  unsupported OpenCL extension 'cl_khr_gl_msaa_sharing' - ignoring

You can condition error directives on CL version passed as it's done in the 
example test SemaOpenCL/extensions.cl.

So what is the original intension of this tests? Not sure I understand what you 
are trying to test.


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-24 Thread Anastasia Stulova via cfe-commits
Anastasia added inline comments.


Comment at: test/SemaOpenCL/extension-version.cl:11
@@ +10,3 @@
+#endif
+#pragma OPENCL EXTENSION cl_clang_storage_class_specifiers: enable
+

Could you use standard diagnostic check please:
  expected-warning{{unknown OpenCL extension ...

Similarly to SemaOpenCL/extensions.cl


Repository:
  rL LLVM

http://reviews.llvm.org/D20447



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D20447: [OpenCL] Fixup extension list

2016-05-23 Thread Jan Vesely via cfe-commits
jvesely retitled this revision from "[OpenCL] cl_khr_msaa_sharing is OpenCL1.2 
extension" to "[OpenCL] Fixup extension list".
jvesely added a subscriber: cfe-commits.
jvesely updated this revision to Diff 58130.
jvesely added a comment.

I went through the specs and fixed up all I could find.
added test


Repository:
  rL LLVM

http://reviews.llvm.org/D20447

Files:
  include/clang/Basic/OpenCLExtensions.def
  test/SemaOpenCL/extension-version.cl

Index: test/SemaOpenCL/extension-version.cl
===
--- /dev/null
+++ test/SemaOpenCL/extension-version.cl
@@ -0,0 +1,168 @@
+// RUN: %clang_cc1 -x cl -cl-std=CL %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.1 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL1.2 %s -verify -triple spir-unknown-unknown
+// RUN: %clang_cc1 -x cl -cl-std=CL2.0 %s -verify -triple spir-unknown-unknown
+// expected-no-diagnostics
+
+// Extensions in all versions
+#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_fp16
+#error "Missing cl_khr_fp16 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp16: enable
+
+#ifndef cl_khr_int64_base_atomics
+#error "Missing cl_khr_int64_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_base_atomics: enable
+
+#ifndef cl_khr_int64_extended_atomics
+#error "Missing cl_khr_int64_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_int64_extended_atomics: enable
+
+#ifndef cl_khr_gl_sharing
+#error "Missing cl_khr_gl_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_sharing: enable
+
+#ifndef cl_khr_icd
+#error "Missing cl_khr_icd define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_icd: enable
+
+// COre features in CL 1.1
+#if (__OPENCL_C_VERSION__ < 110)
+#ifndef cl_khr_byte_addressable_store
+#error "Missing cl_khr_byte_addressable_store define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_byte_addressable_store: enable
+
+#ifndef cl_khr_global_int32_base_atomics
+#error "Missing cl_khr_global_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_base_atomics: enable
+
+#ifndef cl_khr_global_int32_extended_atomics
+#error "Missing cl_khr_global_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_global_int32_extended_atomics: enable
+
+#ifndef cl_khr_local_int32_base_atomics
+#error "Missing cl_khr_local_int32_base_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_base_atomics: enable
+
+#ifndef cl_khr_local_int32_extended_atomics
+#error "Missing cl_khr_local_int32_extended_atomics define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_local_int32_extended_atomics: enable
+
+#ifndef cl_khr_select_fprounding_mode
+#error "Missing cl_khr_select_fp_rounding_mode define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_select_fprounding_mode: enable
+
+#endif
+
+// Core feature in CL 1.2
+#if (__OPENCL_C_VERSION__ < 120)
+#ifndef cl_khr_fp64
+#error "Missing cl_khr_fp64 define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_fp64: enable
+#endif
+
+//Core feature in CL 2.0
+#if (__OPENCL_C_VERSION__ < 200)
+#ifndef cl_khr_3d_image_writes
+#error "Missing cl_khr_3d_image_writes define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_3d_image_writes: enable
+#endif
+
+
+#if (__OPENCL_C_VERSION__ >= 110)
+#ifndef cl_khr_gl_event
+#error "Missing cl_khr_gl_event define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_event: enable
+
+#ifndef cl_khr_d3d10_sharing
+#error "Missing cl_khr_d3d10_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable
+#endif
+
+#if (__OPENCL_C_VERSION__ >= 120)
+#ifndef cl_khr_context_abort
+#error "Missing cl_context_abort define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_context_abort: enable
+
+#ifndef cl_khr_d3d11_sharing
+#error "Missing cl_khr_d3d11_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_d3d10_sharing: enable
+
+#ifndef cl_khr_dx9_media_sharing
+#error "Missing cl_khr_dx9_media_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_dx9_media_sharing: enable
+
+#ifndef cl_khr_image2d_from_buffer
+#error "Missing cl_khr_image2d_from_buffer define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_image2d_from_buffer: enable
+
+#ifndef cl_khr_initialize_memory
+#error "Missing cl_khr_initialize_memory define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_initialize_memory: enable
+
+#ifndef cl_khr_gl_depth_images
+#error "Missing cl_khr_gl_depth_images define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_depth_images: enable
+
+#ifndef cl_khr_gl_msaa_sharing
+#error "Missing cl_khr_gl_msaa_sharing define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_gl_msaa_sharing: enable
+
+#ifndef cl_khr_spir
+#error "Missing cl_khr_spir define"
+#endif
+#pragma OPENCL EXTENSION cl_khr_spir: enable
+#endif
+
+#if (__OPENCL_C_VERSION__ >= 200)
+#ifndef cl_khr_egl_event
+#error "Missing