1 Reply Latest reply on Oct 1, 2010 8:08 AM by himanshu.gautam

    struct float vs float3 vs float4 performance ?

    spectral

      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

        • struct float vs float3 vs float4 performance ?
          himanshu.gautam

          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