Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Unforced avx and avx2 features #10156

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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);
}
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions scripts/cargo-install-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)"

Expand Down