OpenCL:为什么不能将指向指针的指针作为参数传递给内核函数? [英] OpenCL:Why Pointer to a pointer cannot be passed as an argument to a kernel function?

查看:192
本文介绍了OpenCL:为什么不能将指向指针的指针作为参数传递给内核函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只想澄清一下为什么我们不能将2D数组指针作为参数传递给内核. 为什么不允许这样做. 如果将其用作参数会发生什么情况(内部?据我所知,代码会出现一些错误).

Hi, I just want some clarification on Why we can not pass the 2D array pointer as argument to the kernel . Why it is not allowed . What will happen if I use this as argument (Internally??as I know the code will give some error) .

请做有需要的人.

推荐答案

因为在OpenCL 1.x中,设备具有单独的地址空间.在设备上执行的内核不知道该如何处理仅在主机地址空间中有用的指针.

Because in OpenCL 1.x the device has a separate address space. Kernels executing on the device wouldn't know what to do with a pointer that is only useful in host address space.

请注意,在OpenCL 2.0中,共享虚拟内存(SVM)消除了此限制,并允许在主机和设备端使用包含指针的缓冲区.

Note that in OpenCL 2.0 Shared Virtual Memory (SVM) removes this restriction and allows buffers containing pointers to be used on both host and device side.

这篇关于OpenCL:为什么不能将指向指针的指针作为参数传递给内核函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆