From eb51b6b711261ffe1d75d71cd5dfa103f70648be Mon Sep 17 00:00:00 2001 From: Vladislav Volosnikov Date: Thu, 1 Aug 2024 18:59:41 +0200 Subject: [PATCH] Fix avx512 poseidon2 compilation config (#56) --- src/implementations/poseidon2/mod.rs | 13 ++++++------- src/implementations/poseidon2/state_avx512.rs | 5 ----- src/lib.rs | 1 + 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/implementations/poseidon2/mod.rs b/src/implementations/poseidon2/mod.rs index 6dbb7e0..28605cb 100644 --- a/src/implementations/poseidon2/mod.rs +++ b/src/implementations/poseidon2/mod.rs @@ -4,16 +4,17 @@ use crate::field::goldilocks::GoldilocksField; pub mod params; pub mod state_generic_impl; -#[cfg(not(all( - feature = "include_packed_simd", - any( - target_feature = "neon", - target_feature = "avx2", +#[cfg(not(any( + all( target_feature = "avx512bw", target_feature = "avx512cd", target_feature = "avx512dq", target_feature = "avx512f", target_feature = "avx512vl", + ), + all( + feature = "include_packed_simd", + any(target_feature = "neon", target_feature = "avx2") ) )))] pub use state_generic_impl::*; @@ -48,7 +49,6 @@ pub mod state_vectorized_double; pub use state_vectorized_double::*; #[cfg(all( - feature = "include_packed_simd", target_feature = "avx512bw", target_feature = "avx512cd", target_feature = "avx512dq", @@ -58,7 +58,6 @@ pub use state_vectorized_double::*; pub mod state_avx512; #[cfg(all( - feature = "include_packed_simd", target_feature = "avx512bw", target_feature = "avx512cd", target_feature = "avx512dq", diff --git a/src/implementations/poseidon2/state_avx512.rs b/src/implementations/poseidon2/state_avx512.rs index d0a6af5..8cb18b3 100644 --- a/src/implementations/poseidon2/state_avx512.rs +++ b/src/implementations/poseidon2/state_avx512.rs @@ -24,11 +24,6 @@ impl Aligned { } } -// we also need holder for SIMD targets, because u64x4 has smaller alignment than u64x8 -#[derive(Clone, Copy)] -#[repr(C, align(64))] -struct U128x4Holder([packed_simd::u128x4; 3]); - impl std::fmt::Debug for State { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "{:?}", self.0) diff --git a/src/lib.rs b/src/lib.rs index 4f2e1ee..8eb9e9f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,6 +47,7 @@ #![feature(iter_array_chunks)] // #![recursion_limit = "1024"] #![feature(avx512_target_feature)] +#![cfg_attr(target_feature = "avx512bw", feature(stdarch_x86_avx512))] #![feature(associated_type_defaults)] #![feature(trait_alias)] #![feature(vec_push_within_capacity)]