2015-11-05 53 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