PDA

View Full Version : kernel argument without memory space specifier



Jofo
01-28-2010, 04:31 AM
Hello,

I'd like to ask, where a kernel argument is stored, when it doesn't have _global, _public or other memory specifier?

Here is a sample code from one presentation:


char* source = "__kernel void MyKernel(__global int* buffer, int N) {\n"
" if (get_global_id(0) < N) buffer[get_global_id(0)] = 7;\n
"}\n ";

Parameter N does not have memory space specifier. Where is it stored?

dbs2
01-28-2010, 04:58 AM
I believe the default is private.

Jofo
01-28-2010, 10:49 AM
That makes sense...

but how does GPU handle private memory objects? Are they copied to GPU with every thread instance, resulting in extensive brandwidth usage? (f.e. in this case, provided we have a large matrix) Would't it be better to tag N as "_constant"?

dbs2
01-28-2010, 12:48 PM
I don't think that is defined in the spec. I would play it safe and define such things as constants to avoid the ambiguity.