OpenCL 内联函数可以返回 OpenCL 类型吗?
我知道 OpenCL 支持内联函数,但这些函数可以接受并返回 OpenCL 类型吗?
具体来说,我对带有此签名的东西感兴趣: float4 func(float4 x, float4 y)
I know OpenCL supports inline functions, but can those functions accept and return OpenCL types?
Specifically, I am interested in something with this signature:
float4 func(float4 x, float4 y)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,对于大多数 GPU,所有函数都是内联的,即使您没有指定它。
Yes, for most GPUs, all functions are inlined anyway, even if you don't specify it.
只有内核函数具有特定的返回类型,该返回类型为 void。任何其他函数都可以返回任何有效的 OpenCL 类型。
Only kernel functions has a specific return type which is void. Any other function can return any valid OpenCL type.