Elliot Gorokhovsky
Elliot Gorokhovsky

Reputation: 3742

opencl get_local_id or get_global_id in a function called by the kernel

Suppose I have a .cl like this:

void func(whatever){
   int id = get_global_id(0);
   do stuff;
}

__kernel void (whatever){
    func(whatever);
}

Will func be able to access thread-specific functions like get_global_id? It would be annoying to have to manually inline all these functions, and would make the code much less readable.

Upvotes: 1

Views: 872

Answers (1)

jprice
jprice

Reputation: 9925

Yes, all functions are able to use work-item functions like get_global_id(). The only thing you cannot do in a function that is called from a kernel is declare a function scope local memory array.

Upvotes: 1

Related Questions