cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

lust
Journeyman III

ATI Stream SDK OpenCL lacking some basic functionality

Hello,

I needed to define some things to make previous OpenCL code work.

#define __constant __const
#define true 1
#define false 0

Also, indexing in float4s does not work, i.e.

 

 

 



 

 

float4 f; // not working float a = f[3] ;

0 Likes
5 Replies
omkaranathan
Adept I

Originally posted by: lust Hello,

 

I needed to define some things to make previous OpenCL code work.

#define __constant __const

#define true 1

#define false 0

__const, true, false etc are not keywords as per OpenCL specification, which means they will have to be defined explicitly, in case you need to use them. 

 

Also, indexing in float4s does not work, i.e.

This is due to incorrect way of indexing, you can access the 3rd element of a float4 variable by either f.z or f.s2

0 Likes

Well, about true or false it is ok, but nVidia's OpenCL SDK supports indexing in float4s. This is crucial for our application, since it is too frequently used and if we replace it by a swith/case construct this may yield a lot of divergence.

0 Likes

Support for array like indexing for float4 is not a requirement as per OpenCL Specification

0 Likes

Well, it would be nice, and comfortable, for us, poor developers More than the spec is always better

0 Likes

lust,
If you want indexing into floats, use a float array.
In your case above

float f[4];

float a = f[3];

Vectors are not arrays as vectors are mapped to the underlying vector hardware and an array is mapped depending on it's type. NVidia can do this because they are a scalar architecture, so they map all vectors to multiple scalars. One of the reasons for OpenCL is that you don't have to write different code for different vendors for the code to work correctly, by not following the OpenCL spec and allowing things that aren't there, this breaks this situation.
0 Likes