Skip to content

Cannot Compile Kernel #20

@ChrisRackauckas

Description

@ChrisRackauckas

Tests pass for the CL context, but I am not sure where to go with this:

using GPUArrays
u0 = GPUArray(rand(Float32, 32, 32))
abs.(u0)
Couldn't compile kernel: 
    1   : // dependant type declarations
    2   : typedef struct {
    3   : float empty; // structs can't be empty
    4   : }Base21abs;
    5   : 
    6   : // dependant function declarations
    7   : float broadcast_index_2(__global float * restrict  arg, int2 shape, int i)
    8   : {
    9   :     ;
    10  :     return arg[i - 1];
    11  :     ;
    12  : }
    13  : // Main inner function
    14  : __kernel void broadcast_kernel_7(__global float * restrict  A, Base21abs f, int2 sz, __global float * restrict  arg_1)
    15  : {
    16  :     int i;
    17  :     i = get_global_id(0) + 1;
    18  :     float _ssavalue_0;
    19  :     _ssavalue_0 = abs(broadcast_index_2(arg_1, sz, i));
    20  :     A[i - 1] = _ssavalue_0;
    21  :     ;
    22  : }
    23  : 
With following build error:
<kernel>:19:19: error: call to 'abs' is ambiguous
    _ssavalue_0 = abs(broadcast_index_2(arg_1, sz, i));
                  ^~~
cl_kernel.h:2310:24: note: candidate function
uchar __OVERLOADABLE__ abs(char);
                       ^
cl_kernel.h:2311:24: note: candidate function
uchar __OVERLOADABLE__ abs(uchar);
                       ^
cl_kernel.h:2312:25: note: candidate function
ushort __OVERLOADABLE__ abs(short);
                        ^
cl_kernel.h:2313:25: note: candidate function
ushort __OVERLOADABLE__ abs(ushort);
                        ^
cl_kernel.h:2314:23: note: candidate function
uint __OVERLOADABLE__ abs(int);
                      ^
cl_kernel.h:2315:23: note: candidate function
uint __OVERLOADABLE__ abs(uint);
                      ^
cl_kernel.h:2316:24: note: candidate function
ulong __OVERLOADABLE__ abs(long);
                       ^
cl_kernel.h:2317:24: note: candidate function
ulong __OVERLOADABLE__ abs(ulong);
                       ^
cl_kernel.h:2319:25: note: candidate function
uchar2 __OVERLOADABLE__ abs(char2);
                        ^
cl_kernel.h:2321:25: note: candidate function
uchar3 __OVERLOADABLE__ abs(char3);
                        ^
cl_kernel.h:2323:25: note: candidate function
uchar4 __OVERLOADABLE__ abs(char4);                                                              
                        ^
cl_kernel.h:2324:25: note: candidate function
uchar8 __OVERLOADABLE__ abs(char8);                                                              
                        ^
cl_kernel.h:2325:26: note: candidate function
uchar16 __OVERLOADABLE__ abs(char16);                                                            
                         ^
cl_kernel.h:2326:25: note: candidate function
uchar2 __OVERLOADABLE__ abs(uchar2);
                        ^
cl_kernel.h:2328:25: note: candidate function
uchar3 __OVERLOADABLE__ abs(uchar3);                                                             
                        ^
cl_kernel.h:2330:25: note: candidate function
uchar4 __OVERLOADABLE__ abs(uchar4);                                                             
                        ^
cl_kernel.h:2331:25: note: candidate function
uchar8 __OVERLOADABLE__ abs(uchar8);                                                             
                        ^
cl_kernel.h:2332:26: note: candidate function
uchar16 __OVERLOADABLE__ abs(uchar16);                                                           
                         ^
cl_kernel.h:2333:26: note: candidate function
ushort2 __OVERLOADABLE__ abs(short2);                                                            
                         ^
cl_kernel.h:2335:26: note: candidate function
ushort3 __OVERLOADABLE__ abs(short3);                                                            
                         ^
cl_kernel.h:2337:26: note: candidate function
ushort4 __OVERLOADABLE__ abs(short4);                                                            
                         ^
cl_kernel.h:2338:26: note: candidate function
ushort8 __OVERLOADABLE__ abs(short8);                                                            
                         ^
cl_kernel.h:2339:27: note: candidate function
ushort16 __OVERLOADABLE__ abs(short16);                                                          
                          ^
cl_kernel.h:2340:26: note: candidate function
ushort2 __OVERLOADABLE__ abs(ushort2);                                                           
                         ^
cl_kernel.h:2342:26: note: candidate function
ushort3 __OVERLOADABLE__ abs(ushort3);                                                           
                         ^
cl_kernel.h:2344:26: note: candidate function
ushort4 __OVERLOADABLE__ abs(ushort4);                                                           
                         ^
cl_kernel.h:2345:26: note: candidate function
ushort8 __OVERLOADABLE__ abs(ushort8);                                                           
                         ^
cl_kernel.h:2346:27: note: candidate function
ushort16 __OVERLOADABLE__ abs(ushort16);                                                         
                          ^
cl_kernel.h:2347:24: note: candidate function
uint2 __OVERLOADABLE__ abs(int2);
                       ^
cl_kernel.h:2349:24: note: candidate function
uint3 __OVERLOADABLE__ abs(int3);
                       ^
cl_kernel.h:2351:24: note: candidate function
uint4 __OVERLOADABLE__ abs(int4);
                       ^
cl_kernel.h:2352:24: note: candidate function
uint8 __OVERLOADABLE__ abs(int8);
                       ^
cl_kernel.h:2353:25: note: candidate function
uint16 __OVERLOADABLE__ abs(int16);
                        ^
cl_kernel.h:2354:24: note: candidate function
uint2 __OVERLOADABLE__ abs(uint2);
                       ^
cl_kernel.h:2356:24: note: candidate function
uint3 __OVERLOADABLE__ abs(uint3);
                       ^
cl_kernel.h:2358:24: note: candidate function
uint4 __OVERLOADABLE__ abs(uint4);
                       ^
cl_kernel.h:2359:24: note: candidate function
uint8 __OVERLOADABLE__ abs(uint8);
                       ^
cl_kernel.h:2360:25: note: candidate function
uint16 __OVERLOADABLE__ abs(uint16);
                        ^
cl_kernel.h:2361:25: note: candidate function
ulong2 __OVERLOADABLE__ abs(long2);
                        ^
cl_kernel.h:2363:25: note: candidate function
ulong3 __OVERLOADABLE__ abs(long3);
                        ^
cl_kernel.h:2365:25: note: candidate function
ulong4 __OVERLOADABLE__ abs(long4);
                        ^
cl_kernel.h:2366:25: note: candidate function
ulong8 __OVERLOADABLE__ abs(long8);
                        ^
cl_kernel.h:2367:26: note: candidate function
ulong16 __OVERLOADABLE__ abs(long16);
                         ^
cl_kernel.h:2368:25: note: candidate function
ulong2 __OVERLOADABLE__ abs(ulong2);
                        ^
cl_kernel.h:2370:25: note: candidate function
ulong3 __OVERLOADABLE__ abs(ulong3);
                        ^
cl_kernel.h:2372:25: note: candidate function
ulong4 __OVERLOADABLE__ abs(ulong4);
                        ^
cl_kernel.h:2373:25: note: candidate function
ulong8 __OVERLOADABLE__ abs(ulong8);
                        ^
cl_kernel.h:2374:26: note: candidate function
ulong16 __OVERLOADABLE__ abs(ulong16);
                         ^

CLError(code=-11, CL_BUILD_PROGRAM_FAILURE)
in broadcast at GPUArrays\src\abstractarray.jl:186
in acc_broadcast! at GPUArrays\src\backends\opencl\opencl.jl:168
in Type at Transpiler\src\clike/opencl\compilation.jl:79
in get! at base\dict.jl:449
in #27 at Transpiler\src\clike/opencl\compilation.jl:104
in #build! at base\<missing>
in #build!#113 at OpenCL\src\program.jl:101
in macro expansion at OpenCL\src\macros.jl:6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions