[PATCH] D60763: Prototype OpenCL BIFs using Tablegen

Pierre via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 03:34:43 PDT 2019


Pierre marked an inline comment as done.
Pierre added inline comments.


================
Comment at: clang/include/clang/Basic/OpenCLBuiltins.td:298-302
+def write_imagef : Builtin<"write_imagef",
+                            [void_t,
+                              image2d_WO_t,
+                              VectorType<int_t, 2>,
+                              VectorType<float_t, 4>]>;
----------------
AlexeySotkin wrote:
> It seems like there is something wrong with access qualifiers for images. I have applied this patch and tried to compile the following code:
> 
> ```
> typedef int int2 __attribute__((ext_vector_type(2)));
> typedef float float4 __attribute__((ext_vector_type(4)));
> 
> void kernel k(write_only image2d_t image, int2 coord, float4 data) {
>   write_imagef(image, coord, data);
> }
> 
> ```
> I got the following output:
> ```
> clang -cc1 -triple spir /work/tmp/tmp.cl -emit-llvm -o -  -fadd-opencl-builtins
> /work/tmp/tmp.cl:5:16: error: passing '__write_only image2d_t' to parameter of incompatible type '__read_only image2d_t'
>   write_imagef(image, coord, data);
>                          ^~~~~
> 1 error generated.
> ```
What you are saying is right. This patch is incomplete and some features are missing/ broken. 
I have a new version of the tablegen builtin feature where the access qualifiers are actually taken into account, but I cannot extract only this from my version. This would imply uploading the whole new version. 
The new version will hopefully be on top of this patch, making access qualifiers work.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60763/new/

https://reviews.llvm.org/D60763





More information about the cfe-commits mailing list