1 Reply Latest reply on Jul 24, 2008 9:03 PM by MicahVillmow

    What is better

    berathebrain

      I was wondering from the point of GPU is it better to write this:

      kernel void log10f_gpu_ati(float inY<>,out float Y<>{
          const float log10=2.3025850929940456840179914546844;
          Y = log(inY)/log10;
      }

      or this:

      kernel void log10f_gpu_ati(float inY<>,out float Y<>{
          Y = log(inY)/2.3025850929940456840179914546844;
      }

        • What is better
          MicahVillmow
          At the high level the second item looks more efficient, however if you look at the generated IL, what you will notice is that both of them basically do the same thing.

          dcl_literal l0, 2.30258509299, 2.30258509299, 2.30258509299, 2.30258509299
          mov r0, l0
          log r1, inY
          div Y r1, r0
          mov o0, Y

          or something similiar to this.

          In essence the performance for the two cases is identical as the same number of ALU instructions need to be run.