3 ms·
I prefer architectures that have a vector instruction for computing one or two Newton iterations instead. That way you can quickly get the precision that you w
by fluffything 6y ago
I prefer architectures that have a vector instruction for computing one or two Newton iterations instead.
That way you can quickly get the precision that you want ;)
- dragontamer 6y agovrsqrtps executes once-per-cycle throughput on Skylake / Icelake. You can always compute newton's method afterwards to improve the accuracy. But getting the maximum accuracy from one cycle is probably best.
- fluffything 6y agoYou can create an instruction to perform X newton iterations in 1 cycle if you want, and you can pick X to give you 14-bit precision. With such an instruction, you could exponentially increase the precision in 2 cycles by just using the same instruction twice. You can't do that on Intel's hardware. As you mention, you'd need to roll your own multi-SIMD-instruction rsqrt newton iteration complex loop, and use it after the first SIMD call. That's really sad. There is hardware to perform Newton iterations on Intel CPUs, that's how that instruction is implemented, but the ISA only exposes this hardware via the "do a 14-bit rsqrt operation", which means that you can't really use it to increase precision if that does not suffice for your app.