Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upConsider using an embedded libm #711
Comments
steveklabnik
added
the
A-wishlist
label
Jan 23, 2015
This comment has been minimized.
This comment has been minimized.
alexchandel
commented
Dec 1, 2015
|
|
alexchandel
referenced this issue
Dec 1, 2015
Closed
Split the /opt:ref,icf arguments to i686-pc-windows-msvc linker #29126
This comment has been minimized.
This comment has been minimized.
alexchandel
commented
Mar 17, 2016
|
Too bad this was exiled here. Openlibm would be nice. |
This comment has been minimized.
This comment has been minimized.
anatol
commented
Feb 14, 2017
|
Another option wold be implement libm functions in pure Rust. math.rs made a good progress in this area. |
This comment has been minimized.
This comment has been minimized.
tupshin
commented
Feb 14, 2017
|
Worth noting that |
This comment has been minimized.
This comment has been minimized.
binarycrusader
commented
Feb 14, 2017
|
For the sake of distribution maintainers, it would be preferable if there was an option to continue using the system libm instead. For more specialized platforms, libm is often uniquely optimized already for its native architecture. While I applaud the desire to reduce dependencies, libm is not generally a target I would be concerned about. |
This comment has been minimized.
This comment has been minimized.
anatol
commented
Feb 14, 2017
|
How does such option would look like? Is it a compile-time rust flag? I personally prefer to see more efforts spend on optimizing rust implementation of the math functions. Such as using |
This comment has been minimized.
This comment has been minimized.
binarycrusader
commented
Feb 14, 2017
•
Yes, I would suggest it's a compile-time option for rust itself -- in other words, not as a flag for general users of rustc, but for distribution maintainers building rust itself.
But that's exactly why it's important. A build-time option for the use of a native libm allows work to proceed efficiently in a native rust implementation while giving distribution maintainers a way to avoid significant regressions in performance for platforms that have not yet been optimized. It also allows easy regression testing since you can then easily compare test runs between a version of rust built with native libm and one without. It's important to not underestimate the decades of man years that have gone into implementing and optimizing libm on some architectures/platforms. It's also important to remember that inlining is an optimization, not a requirement for correctness and has its own tradeoffs. |
This comment has been minimized.
This comment has been minimized.
anatol
commented
Feb 16, 2017
Nobody is going to throw this work. In fact people are looking at other I ran benchmarks (Arch Linux at i7-6700k) for
The straight-forward
I think it is better to leave this kind of decisions to application developers as they know better requirements for their use-cases.
It does not have to be a compile time option. Rust allows to use C bindings easily. Actually comparing results with
You keep repeating argument that a libraries implemented in Rust are incorrect and slow but I do not understand what makes you believe so. I propose to implement a fast and correct math library in pure Rust. |
This comment has been minimized.
This comment has been minimized.
binarycrusader
commented
Feb 16, 2017
•
To be clear, I only suggested a rust compile-time build option as a minimum -- if the rust maintainers are willing to extend that capability to per-application, that's great.
I have said no such thing. There seems to be a misunderstanding of my concerns, so let me rephrase in a way that will hopefully be clearer. The idea and proposal to implement a correct math library in rust is a fine and wonderful idea. I myself am a strong advocate for rust within the company that employs me, which is why I've recently integrated several small changes to support one of the platforms that I work on. However, as a distribution maintainer, I can say with confidence that libm and related libraries (such as compiler-rt) often either heavily depend upon the compilers they were originally written for to produce specific optimisations, or have hand-crafted assembly. The compiler that rust uses, LLVM, is not yet as mature as gcc or other compilers when it comes to code optimisations, particularly on what some might consider more "exotic" or "niche" platforms. Likewise, gcc is not as correct or optimal at code generation as the native compilers sometimes provided with these platforms, although it's usually better than LLVM in my experience. So then, as a distribution maintainer, it remains important to me that projects such as rust, while they are still maturing or expanding their support for platforms, provide a way for distribution maintainers to make appropriate choices for their platforms based upon platform requirements and other constraints. As such, I am merely suggesting is that if the rust community chooses to pursue a version of libm written in rust, they do so with the consideration that some platforms on which LLVM is not as well optimised would be at a significant disadvantage if they were not able to use the native, equivalent library instead. As just one such example of the difficulties distribution maintainers face, consider a recent bug report where the choice of compiler-rt may have affected platform performance. |
steveklabnik commentedJan 23, 2015
Monday Dec 02, 2013 at 20:41 GMT
For earlier discussion, see rust-lang/rust#10774
This issue was labelled with: I-wishlist in the Rust repository
For performance and consistency reasons, we might want to bundle our own libm. It further reduces our dependency on system libraries, opens the potential for LTO, and gives us something we can control and define.
A good candidate is openlibm, which has a long history.
See rust-lang/rust#5702, rust-lang/rust#1222