Skip to content

Commit

Permalink
Add comments for sqrt.h (#648)
Browse files Browse the repository at this point in the history
  • Loading branch information
linay-xsj authored Sep 21, 2023
1 parent e1d2051 commit 3a5e6ea
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions aie_runtime_lib/AIE2/sqrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@

#include "aie_api/aie.hpp"

// This function implements the computation of square root by the fast inverse
// square root implementation from Quake III Arena. We can solve square root
// just by multiplying the inverse square to the original number.
// float Q_rsqrt( float number )
//{
// long i;
// float x2, y;
// const float threehalfs = 1.5F;
//
// x2 = number * 0.5F;
// y = number;
// i = * ( long * ) &y;
// i = 0x5f3759df - ( i >> 1 );
// y = * ( float * ) &i;
// y = y * ( threehalfs - ( x2 * y * y ) );
//
// return y;
//}
inline __attribute__((always_inline)) v32bfloat16 getSqrtBf16(v32bfloat16 in) {
aie::vector<bfloat16, 32> x = in;
aie::accum<accfloat, 32> x2 =
Expand Down

0 comments on commit 3a5e6ea

Please sign in to comment.