Fast Inverse Square Root
timmmm.github.io
Fast Inverse Square Root
1–10 of 100 posts
Re: Fast Inverse Square Root
#2Re: Fast Inverse Square Root
#3This is an explanation of the fast inverse square root that I hope is easy to understand. I also managed to improve on it a little bit.
Re: Fast Inverse Square Root
#4https://software.intel.com/sites/landingpage/IntrinsicsGuide...
Re: Fast Inverse Square Root
#5Re: Fast Inverse Square Root
#6It may be useful to mention that modern architectures often have vectorized instructions like vrsqrt14ps (accessible via the _mm512_rsqrt14_ps intrinsic) that provides a 14-bit approximation (there are more accurate variants too) in every lane with an inverse throughput of 2. These are faster than the integer bit hacks. https://software.intel.com/sites/landingpage/IntrinsicsGuide...
Though you can still have vectorised support for regular precision for AVX2.
Re: Fast Inverse Square Root
#7Re: Fast Inverse Square Root
#8This is an explanation of the fast inverse square root that I hope is easy to understand. I also managed to improve on it a little bit.
Thanks for this. I have one nit. You show `q = 1598029824 - u/2;` as being identical to `q = 0x5F400000 - u >> 1;`, but every language I know of uses a different order of operations, giving different results. It might be clearest to provide parentheses in the second case.
Re: Fast Inverse Square Root
#9God, this is such an old meme at this point. What's next, telling me how good lisp is?
Re: Fast Inverse Square Root
#10It may be useful to mention that modern architectures often have vectorized instructions like vrsqrt14ps (accessible via the _mm512_rsqrt14_ps intrinsic) that provides a 14-bit approximation (there are more accurate variants too) in every lane with an inverse throughput of 2. These are faster than the integer bit hacks. https://software.intel.com/sites/landingpage/IntrinsicsGuide...
Though worth noting only for specific AVX-512 CPUs. Though you can still have vectorised support for regular precision for AVX2.
https://software.intel.com/sites/landingpage/IntrinsicsGuide...