diff --git a/core/src/validator.rs b/core/src/validator.rs index 55b0fd57151843..cffb51f0e3c018 100644 --- a/core/src/validator.rs +++ b/core/src/validator.rs @@ -774,7 +774,7 @@ fn report_target_features() { // 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 // the mismatch and error cleanly. - #[target_feature(enable = "avx")] + #[cfg(target_feature = "avx")] { if is_x86_feature_detected!("avx") { info!("AVX detected"); @@ -783,6 +783,15 @@ fn report_target_features() { process::exit(1); } } + #[cfg(target_feature = "avx2")] + { + if is_x86_feature_detected!("avx2") { + info!("AVX2 detected"); + } else { + error!("Your machine does not have AVX2 support, please rebuild from source on your machine"); + process::exit(1); + } + } } } diff --git a/scripts/cargo-install-all.sh b/scripts/cargo-install-all.sh index 02fb81f7a40fc3..6a1437a6642b1c 100755 --- a/scripts/cargo-install-all.sh +++ b/scripts/cargo-install-all.sh @@ -51,6 +51,8 @@ fi installDir="$(mkdir -p "$installDir"; cd "$installDir"; pwd)" mkdir -p "$installDir/bin/deps" cargo=cargo +# Trigger the selection of the correct set of processor features such as AVX2. +RUSTFLAGS="$RUSTFLAGS -C target-cpu=native" echo "Install location: $installDir ($buildVariant)"