NVCC issues with volatile float2 and other multidimensional types not supported!

I have observed that there is no support in the compiler for assigning a float2 to a volatille float2:
for example:

volatile float2 z;
float2 y;
.
.
.
z = y; // error: no operator “=” matches these operands
// operand types are: volatile float2 = float2

The above works fine if you replace float2 with float (or int or char). Also does NOT work with float3, char2, etc.

Are people at NVIDIA aware of this issue, and are there any plans to address this issue in future releases of the compiler?

Eddie

typecasting is always an option - can be done on either side.

typecasting is always an option - can be done on either side.

Thanks for responding… unfortunately, typecasting doesn’t work! It doesn’t matter if I try to cast one thing as a volatile float2, or the other as a float2. Both cases give me the same ol ‘error: no operator “=” matches these operands’

My only workaround is to refer to the .x and .y components of each variable. Then mixing and matching volatile and non-volatile works fine. I’d love to be able to avoid this!

Thanks for responding… unfortunately, typecasting doesn’t work! It doesn’t matter if I try to cast one thing as a volatile float2, or the other as a float2. Both cases give me the same ol ‘error: no operator “=” matches these operands’

My only workaround is to refer to the .x and .y components of each variable. Then mixing and matching volatile and non-volatile works fine. I’d love to be able to avoid this!

Sure it is ugly, but usually ptxas will optimize this back into a single 8-byte copy. So it is not as bad as it may seem.

Sure it is ugly, but usually ptxas will optimize this back into a single 8-byte copy. So it is not as bad as it may seem.

I found a way to do the conversion without the compiler complaining. It is ugly I know, but basically you take the address the volatile float2 to get a pointer, cast the pointer to a float2*, then dereference the pointer, which is now a float2, not volatile. So:

volatile float2 z = {1,1};
float2 y;

y = ((float2)&z);