Skip to content

Commit

Permalink
Show blst hardware support in lighthouse --version (#6039)
Browse files Browse the repository at this point in the history
* Show blst hardware support in lighthouse --version

* fix: detect adx extension in runtime

* fix

* add arm detect
  • Loading branch information
scafe3 authored Jul 5, 2024
1 parent 94d55be commit 5b2edfa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lighthouse/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ lazy_static! {
pub static ref LONG_VERSION: String = format!(
"{}\n\
BLS library: {}\n\
BLS hardware acceleration: {}\n\
SHA256 hardware acceleration: {}\n\
Allocator: {}\n\
Profile: {}\n\
Specs: mainnet (true), minimal ({}), gnosis ({})",
SHORT_VERSION.as_str(),
bls_library_name(),
bls_hardware_acceleration(),
have_sha_extensions(),
allocator_name(),
build_profile_name(),
Expand All @@ -50,6 +52,15 @@ fn bls_library_name() -> &'static str {
}
}

#[inline(always)]
fn bls_hardware_acceleration() -> bool {
#[cfg(target_arch = "x86_64")]
return std::is_x86_feature_detected!("adx");

#[cfg(target_arch = "aarch64")]
return std::arch::is_aarch64_feature_detected!("neon");
}

fn allocator_name() -> &'static str {
if cfg!(target_os = "windows") {
"system"
Expand Down

0 comments on commit 5b2edfa

Please sign in to comment.