Skip to content

Commit

Permalink
aaaaaaaaaaaaaaaaaa
Browse files Browse the repository at this point in the history
Bench: 5685651
  • Loading branch information
cosmobobak committed Nov 5, 2024
1 parent 15843eb commit a1197e8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 21 deletions.
12 changes: 4 additions & 8 deletions src/board.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,7 @@ impl Board {

#[cfg(feature = "datagen")]
pub fn regenerate_zobrist(&mut self) {
(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) =
self.generate_pos_keys();
(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) = self.generate_pos_keys();
}

#[cfg(feature = "datagen")]
Expand Down Expand Up @@ -359,8 +358,7 @@ impl Board {
bk: Some(Square::from_rank_file(Rank::Eight, File::from_index(kingside_file as u8).unwrap())),
bq: Some(Square::from_rank_file(Rank::Eight, File::from_index(queenside_file as u8).unwrap())),
};
(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) =
self.generate_pos_keys();
(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) = self.generate_pos_keys();
self.threats = self.generate_threats(self.side.flip());
}

Expand Down Expand Up @@ -418,8 +416,7 @@ impl Board {
bk: Some(Square::from_rank_file(Rank::Eight, File::from_index(black_kingside_file as u8).unwrap())),
bq: Some(Square::from_rank_file(Rank::Eight, File::from_index(black_queenside_file as u8).unwrap())),
};
(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) =
self.generate_pos_keys();
(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) = self.generate_pos_keys();
self.threats = self.generate_threats(self.side.flip());
}

Expand Down Expand Up @@ -561,8 +558,7 @@ impl Board {
self.set_halfmove(info_parts.next())?;
self.set_fullmove(info_parts.next())?;

(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) =
self.generate_pos_keys();
(self.key, self.pawn_key, self.non_pawn_key, self.minor_key, self.major_key) = self.generate_pos_keys();
self.threats = self.generate_threats(self.side.flip());

Ok(())
Expand Down
2 changes: 1 addition & 1 deletion src/nnue/network/layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ mod generic {
mod x86simd {
use super::{
super::{Align64, L1_SIZE, L2_SIZE, L3_SIZE, QA},
FT_SHIFT, L1_MUL, AVX512CHUNK
AVX512CHUNK, FT_SHIFT, L1_MUL,
};
use crate::nnue::{
network::L1_CHUNK_PER_32,
Expand Down
15 changes: 3 additions & 12 deletions src/nnue/simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,7 @@ mod avx2 {
}
#[inline]
pub unsafe fn reduce_add_f32s(vec: &[VecF32; 2]) -> f32 {
let vec = _mm256_add_ps(
vec.get_unchecked(0).inner(),
vec.get_unchecked(1).inner(),
);
let vec = _mm256_add_ps(vec.get_unchecked(0).inner(), vec.get_unchecked(1).inner());

let upper_128 = _mm256_extractf128_ps(vec, 1);
let lower_128 = _mm256_castps256_ps128(vec);
Expand Down Expand Up @@ -693,14 +690,8 @@ mod ssse3 {
}
#[inline]
pub unsafe fn reduce_add_f32s(vec: &[VecF32; 4]) -> f32 {
let vec_a = _mm_add_ps(
vec.get_unchecked(0).inner(),
vec.get_unchecked(2).inner(),
);
let vec_b = _mm_add_ps(
vec.get_unchecked(1).inner(),
vec.get_unchecked(3).inner(),
);
let vec_a = _mm_add_ps(vec.get_unchecked(0).inner(), vec.get_unchecked(2).inner());
let vec_b = _mm_add_ps(vec.get_unchecked(1).inner(), vec.get_unchecked(3).inner());
let vec = _mm_add_ps(vec_a, vec_b);
let upper_64 = _mm_movehl_ps(vec, vec);
let sum_64 = _mm_add_ps(vec, upper_64);
Expand Down

0 comments on commit a1197e8

Please sign in to comment.