cancel
Showing results for 
Search instead for 
Did you mean: 

Archives Discussions

spectral
Adept II

struct float vs float3 vs float4 performance ?

Hi,

Can I compare a struct like this one to a float 3 :

struct Vector3 { float x; float y; float z; }

1) If I use float 3, will it use SIMD ? and on the GPU
2) Comparing float3 vs float4, does the performance will be the same ?
3) If float3 use SIMD what's happening to the last 32 bits of the SIMD operation ?
4) Will the float3 use 3 floats size ? or 4 floats size ?

Thanks

0 Likes
1 Reply
himanshu_gautam
Grandmaster

hi,

0)      Can I compare a struct like this one to a float 3 :

struct Vector3 { float x; float y; float z; }

                Not possible as per C.

 

1)      If I use float 3, will it use SIMD? and on the GPU

 

No,in cpu case the float3 will use only one core. In GPU it can execute independent float3 instructions can run on the 4 VLIW processing elements.

       

2) Comparing float3 vs float4, does the performance will be the same?

The performance only depends on the availability of independent instructions. It is more likely to be present in float4 than in float3.

       

 

3)If float3 use SIMD what's happening to the last 32 bits of the SIMD operation ?

They are not used.

 

4) Will the float3 use 3 floats size ? or 4 floats size ?

I think float3 would use 4float size to maintain alignment

0 Likes