cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

Improving union with type ?

I would like to write something like that :

typedef struct
{
 int a;
 float b;
 float c;
} T1;

typedef struct
{
 float a;
} T2;

typdef union
{
 T1 t1;
 T2 t2;
} ValuesSet;

Like this I can access like this :

ValuesSet set;
set.t1.a = 20; 

Today I have to do the following :

typdef
{
union { 
 T1 t1;

 T2 t2;
} all;
} ValuesSet;

 set.all.t1.a = 20;

It is a longer expression 😞

0 Likes
6 Replies

If you can provide a small example, I can see if it works with our upcoming release.
0 Likes

Thanks Micah,

It is an example in my previous post ! ? !

You can insert this code in any 'opencl sample' to check if it work ?

0 Likes

viewon01,
That is a code snippet, I need the whole kernel that shows the problem to investigate and reproduce the exact issue you are seeing. If I just use a code snippet, then we are testing different things and I might not be able to reproduce your problem.
0 Likes

Hi Micah, thanks for your answer....

It is NOT a bug, I just ask if this 'syntax' is allowed in an OpenCL kernel ?

It is supported in C++ and avoid to write 'shorter' code, simply !

NB: I think it is not yet supported in OpenCL 1.1...

 

Thx

0 Likes

viewon1,
I don't see a reason why that code shouldn't work. If it doesn't, then it is a bug and we should fix it.
0 Likes

viewon01,

I tried the snippet, it works on my system.

Can you provide you SYSTEM detailsS,CPU,GPU,SDK,DRIVER.

you can also send your code at streamdeveloper@amd.com.

0 Likes