6. OpenCL Programming Language
1. Explicit Type Convertion
convert_<dest type name>(scr_type);
转换向量中的元素个数必须相同
可以加入modifier,convert_<dest type name><_sat><_rounding_mode>(src_type);
2. Reintepreting Types Using as_typen()
类型所占字节数要一致
3. Operators
与C99差不多,多了对向量的支持
4. Address Space Qualifiers
__global: allocate from global memory pool,可以使用const来修饰
__local: allocate from local memory shared by all work-items of a work-group
__constant: allocate from constant buffer
__private: 函数中的变量,或者传入函数的参数是在私有空间中的
__kernel函数的参数如果是指针,可以指向__global, __local和__constant
image2d_t和image3d_t永远指向__global地址空间
5. Image Access Qualifiers
__read_only
__write_only
__read_write
6. Function Qualifiers
__kernel: a function to be a kernel that can be executed by an application on an OpenCL device
__kernel函数还可以用__attribute__来修饰
__attribute__((vec_type_hint(<typen>)))
__attribute__((work_group_size_hint(X,Y,Z))):可以让Compiler优化代码