-
Notifications
You must be signed in to change notification settings - Fork 140
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
Faster logl implementation available in FreeBSD msun #203
Comments
For example, there's a recent new |
Looks like the rust guys have done it and maybe worth checking out as well: https://github.com/rust-lang/libm/tree/master/src/math The downside is that it is hard to keep up with the upstream, although nothing much usually changes for a long time. |
Do you mean just indiscriminately replacing all the openlibm implementations with musl implementations, or would somebody first check which implementation is better? |
I am certainly not suggesting indiscriminately replacing it - updating the title since it is a bit misleading. I think we probably want a separate repo to test it out for performance and correctness, and then either handpick specific routines or replace it wholesale. |
If you're going to update log, you should consider using the table-driven methods of PTP Tang (ACM Trans Math Soft, Vol. 16, No. 4, December 1990, Pages 378-400). For Intel-80 bit and IEEE754 128-bit implementations see |
Borrowing the msun log should be fairly straightforward for us since that is what we forked from a while ago. Are there any other msun improvements we should pull in? |
@kargl Looks like that gives us a better |
Yeah, when logl was committed (and the same with expl), the old Sun fdlibm float and double versions were retained. That was partly my fault. I looked at the MUSL code you pointed to. It seems to be a table driven method. I cannot tell it if it is based on PTP Tang's paper or not. |
Would be nice to benchmark the musl implementation. We know we have a slow cc @simonbyrne |
@kargl Would you be able to provide fast |
I copied bits of the musl log into a PR in #204 for experimentation. |
Just discovered that github sets noreply@ addresses in email headers, so my replies have It is unlikely that I'll directly contribute to olibm as I don't use git and olibm source code I have started to rewriting my libm testing code, and have run some tests against FreeBSD FreeBSD libm: ./tlibm -l -P -x 0.5 -X 10 -N 5 -s log Olibm: ./tlibm -l -P -x 0.5 -X 10 -N 5 -s log So, logl() from FreeBSD is 3 times faster and quite a bit better for accuracy. |
a comparison of the accurary of different libraries (including Openlibm) for single precision and rounding to nearest is available at https://members.loria.fr/PZimmermann/papers/accuracy.pdf. Except for erf, Musl has a better accuracy than Openlibm. |
Thanks @zimmermann6! And thank you for creating a github account to post here. I think we may want to split some of these discussions into separate issues. |
@zimmermann6 Is there a repo / test code somewhere, which we can use and incorporate into openlibm tests? |
Moving the larger point around single precision to #212. |
sorry there is no code available yet, but I can provide inputs for which large ulp errors are obtained. |
Looked into what it might take to pull in the newer logl from msun, and it touches a lot of other code. |
In case this information is useful, I just ran benchmarks of openlibm (compiled by gcc and clang) and system libm, and these were the results:
System Libm is considerably faster than Openlibm on Running on Kubuntu 21.04 (kernel 5.11.0-17-generic) in an Asus Rog Strix G531GT, CPU Intel Core i7-9750H CPU 2.60GHz. |
Definitely useful but could you file as a separate issue? |
Jessica, what do you mean by "system libm"? Is it glibc? |
now it is publicly available : https://gitlab.inria.fr/zimmerma/math_accuracy |
Yes, glibc. |
Done. |
The musl libm looks really good and reasonably updated. It would be worthwhile to see if we can set up some scripts to extract to update openlibm. Ideally - we'd be able to do this automatically!
The text was updated successfully, but these errors were encountered: