-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Automatically choose a correct fma
implementation at run time
#9898
Conversation
Do you have an idea about what's broken in the system libm? Or any simple C code to reproduce the bug? It would be nice to report this upstream too. |
The broken system libm is from glibc 2.12, several years out of date (from 2010). Newer versions of glibc are fine (I tested 2.19). I have a simple example that reproduces the problem; in fact, this is what is used at run time to check We could presumably write a configure test, detect this a Julia build time, and pass in a flag to the run-time library. This would be considerably more complex than the current method. The current method is also "obviously correct", as it is guaranteed to check that |
OK, great to know that it's been fixed upstream. I'm fine with the detection code. |
f427492
to
975a7dc
Compare
I agree this is better than a build-time test, as what with us shipping binaries and such, build-time environment can vary quite a bit from the run-time environment. Note that this doesn't quite solve #9847 for me, but I think that's a separate issue, so that shouldn't hold this up. |
Looks good to me, thanks for the fix. I'll reopen #9847 in a second, given E's report that this doesn't quite fix it. |
Automatically choose a correct `fma` implementation at run time
Unfortunately, this generates a bootstrap error on my 32-bit Linux.
|
Damn, thanks for testing. This should maybe be reverted if no one has a quick fix. |
Beats me why the Who's the constant conversion expert? 8-) |
You could remove the respective |
Building now ... |
There's a problem with the system |
... still building. Wondering if you |
Yes, saving and restoring the rounding mode may help -- but it doesn't help for #9847; apparently there are two rounding modes for 32-bit systems. |
Well, the original
Based on previous tests, I don't believe |
What glibc version do you have installed? |
i'm not sure I follow. this PR is a build-time test |
|
I'm looking at (one of) the |
D'oh, right, yeah this ends up making the decision at system image build time, doesn't it. If these instructions are going to be buggy in a lot of places, we might have to make them explicitly opt-in somehow. Or move the check to some |
I guess the easiest option is to add a call to |
We may have to disable LLVM's |
I don't have easy access to a 32-bit Linux system for testing. Could someone test whether the |
@eschnett this seems to have an effect:
(Note that I reverted 975a7dc in order to get this to compile) |
Can you add |
I had to do:
Because if I didn't, I got "function undefined" errors when using |
Was this |
The |
I checked openlibm's The best explanation I've heard is that |
On Ubuntu 14.04 32-bit, I'm using glibc 2.19. Your tests pass, but the rounding mode still gets clobbered:
|
@staticfloat If this is still a problem with glibc, then we should probably file the bug upstream. |
Fixes #9890. May fix #9847.