cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

AblazeSpace
Journeyman III

Weird OpenCL compiler behaviour using explicit casts between vector types

I found some weird ATI OpenCL compiler behaviour using "OpenCL 1.0 ATI-Stream-v2.0.0" ("CAL 1.4.515")

The following is working, but shouldn't according to the OpenCL 1.0 specification?
    float4 f;
    int4 i = (int4)(f);
(on NVIDIA OpenCL compiler "OpenCL 1.0 CUDA", "195.62", this will produce a compiler error... as expected)

From the OpenCL 1.0 specification: "http://www.khronos.org/registry/cl/specs/opencl-1.0.48.pdf" - "6.2.2 Explicit Casts"
    "
    Explicit casts between vector types are not legal. The example below will generate a compilation error.
    float4 f;
    int4 i = (int4) f; // -> not allowed
    "

Is this a bug or do I have overlooked anything?

By the way, the following works correctly according to the OpenCL 1.0 specification:
    float4 f;
    int4 i = (int4)f; // -> not working, but that's correct

And correct conversion:
    float4 f;
    int4 i = convert_int4(f);

0 Likes
1 Reply
genaganna
Journeyman III

AblazeSpace,

       We caught this internally. Yes you are right compiler should give error in this case as per the spec.

0 Likes