OpenCL* for CPU
Ask questions and share information on Intel® SDK for OpenCL™ Applications and OpenCL™ implementations for Intel® CPU.
Announcements
This forum covers OpenCL* for CPU only. OpenCL* for GPU questions can be asked in the GPU Compute Software forum. Intel® FPGA SDK for OpenCL™ questions can be ask in the FPGA Intel® High Level Design forum.
1722 Discussions

OpenCL Compiler Bug Report

Steve_Youngs
Beginner
748 Views
Hi,
The compiler is failing with the following simple kernel:

__kernel void test()
{
float3 a;
if (a.s0 && a.s1 && a.s2)
{
}
}

with an error of

Build Failed!
:4:14: error: invalid operands to binary expression ('float' and 'float')

I'd have expected this to compile OK. It fails in both offline and online compilers. Also fails with || (logical or)
Works correctly with the AMD CPU and GPU compiler.

The workaround is to change the if statement to

if (a.s0 != 0 && a.s1 != 0 && a.s2 != 0)

I'm using Intel OpenCL SDK 1.1

Can you please confirm this is a bug and report it to development?

Steve
0 Kudos
1 Solution
Romain_D_
New Contributor I
748 Views
It isn't a bug ; from OpenCL specifications 1.1.36, 6.3 Operators:

"g. The logical operators and (&&), or (||) operate on all scalar and vector built-in types except
the built-in scalar and vector float types."

View solution in original post

0 Kudos
2 Replies
Romain_D_
New Contributor I
749 Views
It isn't a bug ; from OpenCL specifications 1.1.36, 6.3 Operators:

"g. The logical operators and (&&), or (||) operate on all scalar and vector built-in types except
the built-in scalar and vector float types."

0 Kudos
Steve_Youngs
Beginner
748 Views
Thanks for the clarification Romain. I'll redirect my bug report to AMD for allowing it!

Steve.
0 Kudos
Reply