[PATCH] D60763: Prototype OpenCL BIFs using Tablegen

Alexey Sotkin via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 21 00:07:43 PDT 2019


AlexeySotkin 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>]>;
----------------
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.
```


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

https://reviews.llvm.org/D60763





More information about the cfe-commits mailing list