我如何在 opencl c 内核上使用 vector<char**> 缓冲区或使用此向量设置 SVM?

How could I use a vector<char**> buffer on opencl c kernel or set a SVM with this vector?

我正在尝试分配一个向量(字符串数组)来存储 2 个或更多字符(字节),但是 OpenCL 内核的编译器(clang)在声明一个 char** compressedBytes 时抛出以下错误 kernel parameter cannot be declared as a pointer to a pointer数组

内核: https://gist.github.com/PontiacGTX/0f0897ac1eaf93cb04a5c1e3c205dc4b

主持人: https://gist.github.com/PontiacGTX/745b4942acab0c7213dee1fede6a8e35

内核编译器错误是:

创建内核 1 失败

C:\Users\PONTIA~1\AppData\Local\Temp\OCL4936T1.cl:31:111: 错误:内核参数不能声明为指向指针的指针 __kernel void CopyBytes(__global unsigned char const* fileBytes,unsigned long length,__global unsigned char** compressedBytes, __global unsigned long* arrayCountCompressedBytes) ^

C:\Users\PONTIA~1\AppData\Local\Temp\OCL4936T1.cl:40:16: 警告:不兼容的整数到指针的转换正在使用 'int' 类型的表达式初始化 'const __generic char ' const char str=fileBytes[i] + fileBytes[i+1]; ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\PONTIA~1\AppData\Local\Temp\OCL4936T1.cl:41:9: 警告:不兼容的指针类型将 '__global unsigned char *__generic *' 传递给参数输入 'const __global char *__generic *' 查找(压缩字节、大小、海峡、发现); ^~~~~~~~~~~~~~~

C:\Users\PONTIA~1\AppData\Local\Temp\OCL4936T1.cl:10:33: 注意:这里传递参数给参数'begin' void Find(__global const char** begin, unsigned long length, const char* val, int found) ^

C:\Users\PONTIA~1\AppData\Local\Temp\OCL4936T1.cl:45:23: 错误:将 'const __generic char *' 分配给 '__global unsigned char *__generic' 更改指针的地址space compressedBytes[i]=str; ^~~~

OpenCL doesn't support pointers to random memory inside the kernel. So no pointers of pointers, all you have linear chunks of memory in the form of cl_buffers – Quimby