-
Notifications
You must be signed in to change notification settings - Fork 61
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
Honor RUSTFLAGS's target-cpu if given #75
Honor RUSTFLAGS's target-cpu if given #75
Conversation
Codecov Report
@@ Coverage Diff @@
## master #75 +/- ##
=======================================
Coverage 96.27% 96.27%
=======================================
Files 10 10
Lines 2929 2929
=======================================
Hits 2820 2820
Misses 109 109 Continue to review full report at Codecov.
|
Thanks for the PR! I think the fix is a really nice way of handling that in However, I'm gonna say that I haven't done much Rust nowadays, and so I'll wait a bit and see if other contributors or users have any more feedback. |
@darrenldl Thanks for merging!! Now, I'm looking forward to a new patch release, hopefully. :) |
@ryoqun Thanks for the PR again. I'll finish the required admin work (filling in changelog) and make a release in next 24 hours. |
@ryoqun 4.0.2 has been published to crates.io Let me know if there's any problem - kinda doing it in a rush, sorry if I missed some stuff during publishing. |
For |
Hey, thanks for maintaining a nice crate! This is a tiny build-related PR.
Problem
CPU instruction detection is done at compile time, which isn't compatible for cross-compiling in some case. For example, there is a condition in which compilation is done by a machine with AVX512 and compiled using it and then the binary is transferred to an older machine which lacks the AVX512 support.
Solution
To fix the cross compile issus, we can make
reed-solomon
'sbuild.rs
to accept/honor givenRUSTFLAGS
, which might have some info for intended CPU architecture in it.So, we're forcibly reinterpreting
RUSTFLAGS
'scpu-type
asCFLAGS
's-march
, but it's safe, I think.That's because as far as I'm aware, the acceptable value of
target-cpu
is universal across OSS C and Rust toolchains, becauserust
andclang
share the same backend (LLVM), then LLVM was in turn heavily influenced by the GCC because of the compatibility.Ideally, these should be runtime-based switching for each SIMD implementations, but it would take some more effort than this.
FYI: we're coming from @solana-labs. I'm a collegue with @sakridge, who contributed as well. :) I've created an identical PR for our forked version of this repo: solana-labs#1