关于opencl C 的几点限制

AMD异构开发 2013-10-16 02:29:27
OpenCL C language isbasically standard C (C99) with some extensions and restrictions.
This language is used to program the kernel. Aside from theseextensions and restrictions, the language can be treated the same asC
Restrictions

Below lists the restricted portion from the C language in OpenCL C.


1.The pointer passed as an argument to a kernel function must be of type __global, __constant, or __local.
2.Pointer to a pointer cannot be passed as an argument to a kernel function.
3.Bit-fields are not supported.
4.Variable length arrays and structures with flexible (or unsized) arrays are not supported.
5.Variadic macros and functions are not supported.
6.C99 standard headers cannot be included
7.The extern, static, auto and register storage-class specifiers are not supported.
8.Predefined identifiers are not supported.
9.Recursion is not supported.
10.The function using the __kernel qualifier can only have return type void in the source code.
11.Writes to a pointer of type char, uchar, char2, uchar2, short, ushort, and half are not supported.(1.0之前,1.1版本以后该限制取消)
12.Support for double precision floating-point is currently an optional extension. It may or may not be implemented.

...全文
1379 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
outstander 2013-10-28
  • 打赏
  • 举报
回复
引用 2 楼 liangjunjie_123 的回复:
还是调用支持c++的api比较舒服!
OpenCL现在也支持部分C++特性了,比如说模版
小梁_unique 2013-10-25
  • 打赏
  • 举报
回复
还是调用支持c++的api比较舒服!
zenny_chen 2013-10-16
  • 打赏
  • 举报
回复
OpenCL的内建函数的类型都是可以自动识别的,不需要像真正C语言接口那样,每种类型搞个类型后缀~这点还是非常方便的。 其实OpenCL的语法像现在那么简洁也是件好事。既易读又减少编译器的压力~

602

社区成员

发帖
与我相关
我的任务
社区描述
异构开发技术
社区管理员
  • OpenCL和异构编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧