diff --git a/src/nnue/features/full_threats.cpp b/src/nnue/features/full_threats.cpp index fefe9681f..4cd0cc77c 100644 --- a/src/nnue/features/full_threats.cpp +++ b/src/nnue/features/full_threats.cpp @@ -275,8 +275,6 @@ void FullThreats::append_changed_indices(Color perspective, const DiffType& diff, IndexList& removed, IndexList& added, - FusedUpdateData* fusedData, - bool first, const ThreatWeightType* prefetchBase, IndexType prefetchStride) { @@ -288,36 +286,6 @@ void FullThreats::append_changed_indices(Color perspective, auto to = dirty.threatened_sq(); auto add = dirty.add(); - if (fusedData) - { - if (from == fusedData->dp2removed) - { - if (add) - { - if (first) - { - fusedData->dp2removedOriginBoard |= to; - continue; - } - } - else if (fusedData->dp2removedOriginBoard & to) - continue; - } - else if (to != SQ_NONE && to == fusedData->dp2removed) - { - if (add) - { - if (first) - { - fusedData->dp2removedTargetBoard |= from; - continue; - } - } - else if (fusedData->dp2removedTargetBoard & from) - continue; - } - } - auto& insert = add ? added : removed; const IndexType index = make_index(perspective, attacker, from, to, attacked, ksq); @@ -328,8 +296,4 @@ void FullThreats::append_changed_indices(Color perspective, } } -bool FullThreats::requires_refresh(const DiffType& diff, Color perspective) { - return perspective == diff.us && (i8(diff.ksq) & 0b100) != (i8(diff.prevKsq) & 0b100); -} - } // namespace Stockfish::Eval::NNUE::Features diff --git a/src/nnue/features/full_threats.h b/src/nnue/features/full_threats.h index 6c62ae75c..5cc4d977b 100644 --- a/src/nnue/features/full_threats.h +++ b/src/nnue/features/full_threats.h @@ -13,7 +13,7 @@ along with this program. If not, see . */ -//Definition of input features Simplified_Threats of NNUE evaluation function +//Definition of input features Full_Threats of NNUE evaluation function #ifndef NNUE_FEATURES_FULL_THREATS_INCLUDED #define NNUE_FEATURES_FULL_THREATS_INCLUDED @@ -34,9 +34,6 @@ static constexpr int numValidTargets[PIECE_NB] = {0, 6, 10, 8, 8, 10, 0, 0, class FullThreats { public: - // Feature name - static constexpr const char* Name = "Full_Threats(Friend)"; - // Hash value embedded in the evaluation file static constexpr u32 HashValue = 0x8f234cb8u; @@ -66,13 +63,6 @@ class FullThreats { }; // clang-format on - struct FusedUpdateData { - Bitboard dp2removedOriginBoard = 0; - Bitboard dp2removedTargetBoard = 0; - - Square dp2removed; - }; - // Maximum number of simultaneously active features. static constexpr IndexType MaxActiveDimensions = 128; using IndexList = ValueList; @@ -90,14 +80,8 @@ class FullThreats { const DiffType& diff, IndexList& removed, IndexList& added, - FusedUpdateData* fd = nullptr, - bool first = false, const ThreatWeightType* prefetchBase = nullptr, IndexType prefetchStride = 0); - - // Returns whether the change stored in this DirtyPiece means - // that a full accumulator refresh is required. - static bool requires_refresh(const DiffType& diff, Color perspective); }; } // namespace Stockfish::Eval::NNUE::Features diff --git a/src/nnue/features/half_ka_v2_hm.cpp b/src/nnue/features/half_ka_v2_hm.cpp index 4b11b5b28..219feb5dd 100644 --- a/src/nnue/features/half_ka_v2_hm.cpp +++ b/src/nnue/features/half_ka_v2_hm.cpp @@ -20,11 +20,13 @@ #include "half_ka_v2_hm.h" -#include "../../bitboard.h" -#include "../../position.h" #include "../../types.h" #include "../nnue_common.h" +#if defined(USE_AVX512ICL) + #include "../../bitboard.h" +#endif + namespace Stockfish::Eval::NNUE::Features { #if defined(USE_AVX512ICL) @@ -91,18 +93,6 @@ IndexType HalfKAv2_hm::make_index(Color perspective, Square s, Piece pc, Square + KingBuckets[int(ksq) ^ flip]; } -// Get a list of indices for active features - -void HalfKAv2_hm::append_active_indices(Color perspective, const Position& pos, IndexList& active) { - Square ksq = pos.square(perspective); - Bitboard bb = pos.pieces(); - while (bb) - { - Square s = pop_lsb(bb); - active.push_back(make_index(perspective, s, pos.piece_on(s), ksq)); - } -} - // Get a list of indices for recently changed features void HalfKAv2_hm::append_changed_indices( diff --git a/src/nnue/features/half_ka_v2_hm.h b/src/nnue/features/half_ka_v2_hm.h index 819bcb0f1..71dcb6baf 100644 --- a/src/nnue/features/half_ka_v2_hm.h +++ b/src/nnue/features/half_ka_v2_hm.h @@ -16,7 +16,7 @@ along with this program. If not, see . */ -//Definition of input features HalfKP of NNUE evaluation function +//Definition of input features HalfKAv2_hm of NNUE evaluation function #ifndef NNUE_FEATURES_HALF_KA_V2_HM_H_INCLUDED #define NNUE_FEATURES_HALF_KA_V2_HM_H_INCLUDED @@ -25,10 +25,6 @@ #include "../../types.h" #include "../nnue_common.h" -namespace Stockfish { -class Position; -} - namespace Stockfish::Eval::NNUE::Features { // Feature HalfKAv2_hm: Combination of the position of own king and the @@ -61,9 +57,6 @@ class HalfKAv2_hm { PS_NONE, PS_W_PAWN, PS_W_KNIGHT, PS_W_BISHOP, PS_W_ROOK, PS_W_QUEEN, PS_KING, PS_NONE}}; public: - // Feature name - static constexpr const char* Name = "HalfKAv2_hm(Friend)"; - // Hash value embedded in the evaluation file static constexpr u32 HashValue = 0x7f234cb8u; @@ -120,10 +113,6 @@ class HalfKAv2_hm { static IndexType make_index(Color perspective, Square s, Piece pc, Square ksq); - // Get a list of indices for active features - - static void append_active_indices(Color perspective, const Position& pos, IndexList& active); - // Get a list of indices for recently changed features static void append_changed_indices( Color perspective, Square ksq, const DiffType& diff, IndexList& removed, IndexList& added); diff --git a/src/nnue/nnue_accumulator.cpp b/src/nnue/nnue_accumulator.cpp index b941f71fa..a65c3a9a2 100644 --- a/src/nnue/nnue_accumulator.cpp +++ b/src/nnue/nnue_accumulator.cpp @@ -358,13 +358,13 @@ void update_accumulator_incremental(Color perspective, if constexpr (Forward) { ThreatFeatureSet::append_changed_indices(perspective, ksq, dirtyThreats, thrRemoved, - thrAdded, nullptr, false, pfBase, pfStride); + thrAdded, pfBase, pfStride); PSQFeatureSet::append_changed_indices(perspective, ksq, dirtyPiece, psqRemoved, psqAdded); } else { ThreatFeatureSet::append_changed_indices(perspective, ksq, dirtyThreats, thrAdded, - thrRemoved, nullptr, false, pfBase, pfStride); + thrRemoved, pfBase, pfStride); PSQFeatureSet::append_changed_indices(perspective, ksq, dirtyPiece, psqAdded, psqRemoved); } diff --git a/src/nnue/nnue_common.h b/src/nnue/nnue_common.h index 73361c03e..14bdd8783 100644 --- a/src/nnue/nnue_common.h +++ b/src/nnue/nnue_common.h @@ -67,10 +67,8 @@ constexpr u32 Version = 0x6A448AFAu; // Constant used in evaluation value calculation constexpr int OutputScale = 16; constexpr int WeightScaleBits = 6; -constexpr int FtOneVal = 256; constexpr int FtMaxVal = 255; constexpr int HiddenOneVal = 128; -constexpr int HiddenMaxVal = 127; // Size of cache line (in bytes) constexpr usize CacheLineSize = 64; diff --git a/src/position.cpp b/src/position.cpp index 2e35e78ac..a481286aa 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -862,12 +862,10 @@ void Position::do_move(Move m, Piece pc = piece_on(from); Piece captured = m.type_of() == EN_PASSANT ? make_piece(them, PAWN) : piece_on(to); - dp.pc = pc; - dp.from = from; - dp.to = to; - dp.add_sq = SQ_NONE; - dts.us = us; - dts.prevKsq = square(us); + dp.pc = pc; + dp.from = from; + dp.to = to; + dp.add_sq = SQ_NONE; assert(color_of(pc) == us); assert(captured == NO_PIECE || color_of(captured) == (m.type_of() != CASTLING ? them : us)); @@ -1080,8 +1078,6 @@ void Position::do_move(Move m, } } - dts.ksq = square(us); - assert(pos_is_ok()); assert(dp.pc != NO_PIECE); diff --git a/src/types.h b/src/types.h index ba1e8bb70..e832b023c 100644 --- a/src/types.h +++ b/src/types.h @@ -339,8 +339,6 @@ using DirtyThreatList = ValueList; struct DirtyThreats { DirtyThreatList list; - Color us; - Square prevKsq, ksq; }; #define ENABLE_INCR_OPERATORS_ON(T) \