Earlier quoted context omitted.
Even scientific calculation would be fine with 32 bit floats, but average floating point error due to representation creeps with ON (iirc) over N multiplications, so you have to use 64 bit for many scientific applications to get satisfactory results after a million or a trillion multiplications.
Not really - https://en.wikipedia.org/wiki/Numerical_stability If your algorithm is not stable then even 64-bit won't help you. Compare Euler vs Verlet - https://en.wikipedia.org/wiki/Verlet_integration
Improving the fast inverse square root (2010)
21–30 of 60 posts
Re: Improving the fast inverse square root (2010)
#22That's great and all, but nobody needs a 32-bit anything in 2018. This undergraduate paper provides a magic number and associated error bound for 64-bit doubles: https://cs.uwaterloo.ca/~m32rober/rsqrt.pdf
Then why x86-64 integer instructions default to 32-bit register size when REX prefix byte is not present?
You can double x86 FP throughput using 32-bit floats versus 64 bit ones.
For GPUs, the performance 32-bit float performance advantage can be more than 4-10x (sometimes a lot more).
Re: Improving the fast inverse square root (2010)
#23Earlier quoted context omitted.
That's not really accurate. Even in cases were 32 bit and 64 bit operations are equally fast on the CPU, 32 bit values still take up half the memory. For many workloads, the limiting factor is cache space. So, if you can use 32 but values, you can get much better performance for those workloads.
And if you’re doing heavy floating point work, you can fit twice as many operations in with a 32-bit float vector as an equally sized double vector, and The vectorized operations happen roughly as fast for both forms, yielding an approximate doubling of speed.
Re: Improving the fast inverse square root (2010)
#24It is worth noting that with AVX-512, Intel has introduced a native inverse sqrt approximation (VRSQRT14).
Inverse sqrt approximation is available since SSE1 with rsqrtss & rsqrtps instructions.
Both reciprocal (inverse) square root SSE SIMD instructions were available in Intel Pentium III, released in 1999.
Re: Improving the fast inverse square root (2010)
#25Earlier quoted context omitted.
And if you’re doing heavy floating point work, you can fit twice as many operations in with a 32-bit float vector as an equally sized double vector, and The vectorized operations happen roughly as fast for both forms, yielding an approximate doubling of speed.
for rank-2 tensor work you can do 4x as many operations, for rank-3 tensor work, it's 8x, assuming memory bandwidth is the bottleneck.
Re: Improving the fast inverse square root (2010)
#26It is worth noting that with AVX-512, Intel has introduced a native inverse sqrt approximation (VRSQRT14).
https://software.intel.com/en-us/articles/reference-implemen...
Re: Improving the fast inverse square root (2010)
#27Earlier quoted context omitted.
for rank-2 tensor work you can do 4x as many operations, for rank-3 tensor work, it's 8x, assuming memory bandwidth is the bottleneck.
Does that mean it’s 64x as fast for 16-bit floating point vs 64-bit for a rank 3 tensor?
I think that GPUs are still vector processing engines, so they should scale with 4x... But assuming google architected the TPU correctly, it should be 16x as fast (I think the architecture is actually that of a rank-2 tensor).
Re: Improving the fast inverse square root (2010)
#28It is worth noting that with AVX-512, Intel has introduced a native inverse sqrt approximation (VRSQRT14).
VRSQRT28 too, which has max 2^-28 rel error. https://software.intel.com/en-us/articles/reference-implemen...
Re: Improving the fast inverse square root (2010)
#29E.g. Puls from 2009: https://www.pouet.net/prod.php?which=53816 (check the youtube link if you don't have an MS-DOS ready)
I understand little about extreme sizecoding, but I suspect it's a similarly obsessed mathy story as this blog post, to double use the same bytes as code and content in a way that things actually work and look great.
Re: Improving the fast inverse square root (2010)
#30Earlier quoted context omitted.
Not really - https://en.wikipedia.org/wiki/Numerical_stability If your algorithm is not stable then even 64-bit won't help you. Compare Euler vs Verlet - https://en.wikipedia.org/wiki/Verlet_integration
You're making a different argument.