Midlevel compiler failed on simply kernel

Midlevel compiler failed on simply kernel


On this kernel OpenCL compiler gives the error.

#define bswap32(x) ( ((x) << 24) | (((x) << 8) & 0x00ff0000) | (((x) >> 8) & 0x0000ff00) | ((x) >> 24) )
__kernel void buggy(const uint input, __global uint * output)
output[0] = swap(input);

Error is:

fcl build 1 succeeded.

error: Cannot select: 0x2d4e258: i32 = bswap 0x2d4e0c0 [ORD=1] [ID=6]

0x2d4e0c0: i32,ch = CopyFromReg 0x2d61944, 0x2d4e038 [ORD=1] [ID=4]

0x2d4e038: i32 = Register %vreg0 [ORD=1] [ID=1]

error: midlevel compiler failed build.

Build failed!

If I change swap definition to anything else, like,

#define bswap32(a) (as_uint(as_uchar4(a).wzyx))

everything is ok.

It's interesting that NVIDIA had the same bug:


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I am able to reproduce the issue. Thanks for posting the kernel. Will get back to you with more findings.


It seems to be fixed in driver. Thanks.

Leave a Comment

Please sign in to add a comment. Not a member? Join today