[PATCH] D18369: [OpenCL] Upstreaming khronos OpenCL header file.

Alexey Bader via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 18 10:34:14 PDT 2016


bader added inline comments.

================
Comment at: lib/Headers/opencl.h:14473-14474
@@ +14472,4 @@
+
+float4 __const_func __attribute__((overloadable)) read_imagef(read_only image2d_t image, sampler_t sampler, int2 coord);
+float4 __const_func __attribute__((overloadable)) read_imagef(read_only image2d_t image, sampler_t sampler, float2 coord);
+
----------------
'const' attribute can't be applied to the read_image* functions, because image2d_t it's handle to the image that located in global memory:

"Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory.
Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const"

https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#Common-Function-Attributes

Please, apply 'pure' attribute.



http://reviews.llvm.org/D18369





More information about the cfe-commits mailing list