Fix avx check with newest nightly compiler (#13465) (#13809)

(cherry picked from commit c644b05c54)

Co-authored-by: sakridge <sakridge@gmail.com>
This commit is contained in:
mergify[bot]
2020-11-25 10:50:36 +00:00
committed by GitHub
parent 5dbec42394
commit 51e8872804

View File

@ -947,20 +947,24 @@ fn report_target_features() {
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
{ {
unsafe { check_avx() };
}
}
// Validator binaries built on a machine with AVX support will generate invalid opcodes // Validator binaries built on a machine with AVX support will generate invalid opcodes
// when run on machines without AVX causing a non-obvious process abort. Instead detect // when run on machines without AVX causing a non-obvious process abort. Instead detect
// the mismatch and error cleanly. // the mismatch and error cleanly.
#[target_feature(enable = "avx")] #[target_feature(enable = "avx")]
{ unsafe fn check_avx() {
if is_x86_feature_detected!("avx") { if is_x86_feature_detected!("avx") {
info!("AVX detected"); info!("AVX detected");
} else { } else {
error!("Your machine does not have AVX support, please rebuild from source on your machine"); error!(
"Your machine does not have AVX support, please rebuild from source on your machine"
);
process::exit(1); process::exit(1);
} }
} }
}
}
// Get the activated stake percentage (based on the provided bank) that is visible in gossip // Get the activated stake percentage (based on the provided bank) that is visible in gossip
fn get_stake_percent_in_gossip(bank: &Bank, cluster_info: &ClusterInfo, log: bool) -> u64 { fn get_stake_percent_in_gossip(bank: &Bank, cluster_info: &ClusterInfo, log: bool) -> u64 {