From 5b2edfa0bd8489beb8f874e1d70085b0d20a312e Mon Sep 17 00:00:00 2001 From: scafe3 <161312198+scafe3@users.noreply.github.com> Date: Fri, 5 Jul 2024 07:49:07 +0100 Subject: [PATCH] Show `blst` hardware support in `lighthouse --version` (#6039) * Show blst hardware support in lighthouse --version * fix: detect adx extension in runtime * fix * add arm detect --- lighthouse/src/main.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lighthouse/src/main.rs b/lighthouse/src/main.rs index 47b44d3828f..a7521d5f8cd 100644 --- a/lighthouse/src/main.rs +++ b/lighthouse/src/main.rs @@ -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(), @@ -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"