OpenCL 1.0 Specification阅读笔记(8)

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优化代码

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值