
On Tue, 2023-05-30 at 23:31 -0700, Stefan van der Walt wrote:
Hi Sebastian,
Could you clarify whether there are now varying code paths, depending on the CPU features available?
There is less variation then before because the new code path will be taken on practically all CPUs and I would think with the exact same algorithm (although some values fall-back to the default implementation probably). But before not super many end-users may have hit the less precise results in practice (only some CPUs).
As mentioned on the skimage issue, if results differ but errors are reduced across the board, I'd be happy to fix the test suite. But if this simply jiggers results, I'm less sure it is worth it.
The errors are basically identical to before on AVX512 machines but differ and slightly larger around those special values. On most machines you used to get the very precise default math results.
You also mentioned a potential middle ground, where the approximating polynomial could be expanded by another term?
Yes, it is plausible that the team working on this can improve the precision, I am not sure how quickly that could happen and how the new trade-offs would be. - Sebastian
Overall, I feel this is a rather invasive change to NumPy that affects results that have been stable for many years, so it warrants careful consideration--perhaps even postponing until 2.0?
Best regards, Stéfan
On Tue, May 30, 2023, at 22:55, Sebastian Berg wrote:
Hi all,
there was recently a PR to NumPy to improve the performance of sin/cos on most platforms (on my laptop it seems to be about 5x on simple inputs). This changes the error bounds on platforms that were not previously accelerated (most users):
https://github.com/numpy/numpy/pull/23399
The new error is <4 ULP similar to what it was before, but only on high end Intel CPUs which not users would have noticed. And unfortunately, it is a bit unclear whether this is too disruptive or not.
NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-leave@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/ Member address: sebastian@sipsolutions.net