2015-11-05 54 views
0

我想在两个内核之间的OpenCL 2.0中实现管道。但是内核的编译失败,因为自变量的转换:OpenCL:从'int *'转换为'__generic int * __ generic *'

error: no matching function for call to 'write_pipe' 
write_pipe(outputPipe, &value); 
^~~~~~~~~~ 
note: candidate function not viable: no known conversion from 'int *' to '__generic int *__generic *' for 2nd argument 
note: candidate function not viable: requires 4 arguments, but 2 were provided 

生产者内核很简单:

__kernel void pipe_kernel(__write_only pipe int *outputPipe) { 
    int value = 1; 
    write_pipe(outputPipe, &value); 
} 

的write_kernel功能接口:

int write_pipe (pipe gentype p, const gentype *ptr) 

主机代码中的管道设置为使用整数:

cl_mem pipe = clCreatePipe(context, CL_MEM_READ_WRITE, sizeof(int), elements, NULL, &status); 
clSetKernelArg(pipe_kernel, 0, sizeof(cl_mem), &pipe); 

是否有一个通用地址空间必须考虑管道?

回答

1

的问题是,你的pipe内核参数被声明为指针:

__write_only pipe int *outputPipe 

应该仅仅是:

__write_only pipe int outputPipe 
+0

非常感谢现在的工作如预期! – Objective