View Full Version : kernel argument without memory space specifier

01-28-2010, 03:31 AM

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?

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

01-28-2010, 09: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"?

01-28-2010, 11:48 AM
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.