投射本地指针

时间:2015-10-03 14:23:00

标签: opencl

我有一个本地uchar指针,我想将它转换为本地ulong指针。

 local uchar* foo;
 local ulong* bar = (local ulong*)foo;

当我这样做时,内存条指向不等于foo指向的内存。这是一个错误,还是我做错了什么?

1 个答案:

答案 0 :(得分:0)

您可以参考此页:

https://software.intel.com/en-us/articles/the-generic-address-space-in-opencl-20

http://www.fixstars.com/en/opencl/book/OpenCLProgrammingBook/opencl-c/

How to type-cast char* to int* in openCL

void foo(global unsigned int *bar)  // ‘global’ address space on bar, works in both OCL 1.2 and OCL 2.0 with no additional flags to compile

    {

        local unsigned int *temp = NULL;//’local’ address space on temp, works in both OCL 1.2 and OCL 2.0 with no additional flags to compile

    }