In OpenCL 1.1 my call to function min() is ambiguous and I can't figure out why -


i upgraded opencl 1.0 1.1. when make call min() function, error output:

    <program source>:45:44: error: call 'min' ambiguous             int nframesthiskernelingests = min(nframestoingest  - navg*npp*get_global_id(2), navg*npp);  <built-in>:3569:27: note: candidate function double16 __overloadable__ min(double16, double16);                                                                           ^ <built-in>:3568:26: note: candidate function double8 __overloadable__ min(double8, double8);    

the error output continues more lines different types.

when tried isolate problem, get_global_id(2) appears problem. thought casting get_global_id(2) int uint (i believe returns uint) solve problem doesn't. know going on? looked @ 1.0 , 1.1 specs , still confused why happening.

the opencl 1.0 , 1.1 specifications define min have following function signatures:

gentype min (gentype x, gentype y)  gentype min (gentype x, sgentype y) 

as such, argument types must same, or 1 vector , scalar matching vector element type e.g.

int4 a,b; int c;  min(a,b); // arguments have same type min(a,c); // 2nd element may scalar, matching            // element type of 1st argument ( vector type ) 

note return type of get_global_id size_t, may 32 or 64bits in size.

you have cast expression results select specific overload of min.

there many overloads of min (as compiler error message unhelpfully indicating) e.g.

min(float  a, float  b); min(float2 a, float2 b); min(float2 a, float  b); min(float3 a, float3 b); min(float3 a, float  b); min(float4 a, float4 b); ... // , vector sizes 4,8,16 min(double a, double b); // opencl 64bit floating point extension enabled min(double2 a, double b); // opencl 64bit floating point extension enabled ... // , integral scalar , vector types (char, schar, short, ushort, int, etc)  ... 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -