Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replacing CRlibm with CORE-MATH #592

Open
OlivierHnt opened this issue Dec 1, 2023 · 7 comments
Open

Replacing CRlibm with CORE-MATH #592

OlivierHnt opened this issue Dec 1, 2023 · 7 comments
Assignees

Comments

@OlivierHnt
Copy link
Member

OlivierHnt commented Dec 1, 2023

In a recent triage call, we discussed replacing CRlibm with CORE-MATH, which provides a more complete set of correctly rounded functions.

On particular appeal is that they give a correctly rounded version of pow, which should fix long standing performance issues for powers in IntervalArithmetic.jl.

@giordano I noticed that you created the CRlibm_jll binaries with Yggdrasil.jl. I tried to reproduce this on my computer today for core-math, but I am out of my depth here and could not make it work. The repository on GitLab is not a library per se, but it contains all the C functions. Do you think we can compile CORE-MATH into some CoreMath_jll binaries as easily?

@OlivierHnt OlivierHnt mentioned this issue Dec 1, 2023
1 task
@lucaferranti lucaferranti self-assigned this Dec 4, 2023
@lucaferranti
Copy link
Member

havent forgotten, working hard hardly working

@dpsanders
Copy link
Member

I'm not sure that Core-Math can be used for our purporse, since it apparently requires using fesetround to specify the rounding mode required, which has caused issues with LLVM in the past

@dpsanders
Copy link
Member

Also changing the processor's rounding mode is not thread-safe.

I suggest reaching out to Paul Zimmermann to discuss this. (W e had an email conversation about it, but I dropped the ball.)

@dpsanders
Copy link
Member

Hmm, apparently the state of fesetround is supposed to be per thread. But this will need careful implementation and testing!

@dpsanders
Copy link
Member

The other approach with this is performance. Changing the rounding mode clears out the processor pipeline (or at least used to?) so will be much slower (?)

@dpsanders
Copy link
Member

If I remember correctly he suggested using the prevfloat / next float approach for performance...!

@OlivierHnt
Copy link
Member Author

Interesting, thanks for pointing this out.
Using Core-Math does not solve all the performance issues, but it does (or seems to) avoid using MPFR.
I will have to take a closer look at fesetround, I do not know much on the inner workings of these things. I do hope that a modern and maintained library for correctly rounded functions can be incorporated into Julia 🙂.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants