cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

bubu
Adept II

Call function pointer inside OpenCL code

Is it possible to call a function pointer from OpenCL code?

 

Example:

 

__device int MyAddFunction ( const int a, const int b )

{

   return a+b;

}

 

typedef void (*func) ( const int a, const int b );

__kernel void main ( global int *a, global int*b, global int *out )

{

      func myFunc = MyAddFunction;

      const int idx = get_global_id(0);

      out[idx] = myFunc(a[idx],b[idx]);

}

 

???

thx

0 Likes
1 Reply
nou
Exemplar

no see 6.8.a of specification

0 Likes