diff --git a/src/nnue/features/half_ka_v2_hm.cpp b/src/nnue/features/half_ka_v2_hm.cpp index 5bb0296e2..81eddb060 100644 --- a/src/nnue/features/half_ka_v2_hm.cpp +++ b/src/nnue/features/half_ka_v2_hm.cpp @@ -77,10 +77,6 @@ template void HalfKAv2_hm::append_changed_indices(Square ksq, IndexList& removed, IndexList& added); -int HalfKAv2_hm::update_cost(const StateInfo* st) { return st->dirtyPiece.dirty_num; } - -int HalfKAv2_hm::refresh_cost(const Position& pos) { return pos.count(); } - bool HalfKAv2_hm::requires_refresh(const StateInfo* st, Color perspective) { return st->dirtyPiece.piece[0] == make_piece(perspective, KING); } diff --git a/src/nnue/features/half_ka_v2_hm.h b/src/nnue/features/half_ka_v2_hm.h index ca940c54e..0a420cd1e 100644 --- a/src/nnue/features/half_ka_v2_hm.h +++ b/src/nnue/features/half_ka_v2_hm.h @@ -135,11 +135,6 @@ class HalfKAv2_hm { static void append_changed_indices(Square ksq, const DirtyPiece& dp, IndexList& removed, IndexList& added); - // Returns the cost of updating one perspective, the most costly one. - // Assumes no refresh needed. - static int update_cost(const StateInfo* st); - static int refresh_cost(const Position& pos); - // Returns whether the change stored in this StateInfo means // that a full accumulator refresh is required. static bool requires_refresh(const StateInfo* st, Color perspective); diff --git a/src/nnue/nnue_feature_transformer.h b/src/nnue/nnue_feature_transformer.h index 931d9aed5..60a044158 100644 --- a/src/nnue/nnue_feature_transformer.h +++ b/src/nnue/nnue_feature_transformer.h @@ -254,7 +254,6 @@ class FeatureTransformer { // Number of output dimensions for one side static constexpr IndexType HalfDimensions = TransformedFeatureDimensions; - static constexpr bool Big = TransformedFeatureDimensions == TransformedFeatureDimensionsBig; private: using Tiling = SIMDTiling; @@ -836,23 +835,17 @@ class FeatureTransformer { if ((st->*accPtr).computed[Perspective]) return; // nothing to do - [[maybe_unused]] // only used when !Big - int gain = FeatureSet::refresh_cost(pos); // Look for a usable already computed accumulator of an earlier position. - // When computing the small accumulator, we keep track of the estimated gain in - // terms of features to be added/subtracted. - // When computing the big accumulator, we expect to be able to reuse any - // accumulators, so we always try to do an incremental update. + // Always try to do an incremental update as most accumulators will be reusable. do { - if (FeatureSet::requires_refresh(st, Perspective) - || (!Big && (gain -= FeatureSet::update_cost(st) < 0)) || !st->previous + if (FeatureSet::requires_refresh(st, Perspective) || !st->previous || st->previous->next != st) { // compute accumulator from scratch for this position update_accumulator_refresh_cache(pos, cache); - if (Big && st != pos.state()) - // when computing a big accumulator from scratch we can use it to + if (st != pos.state()) + // when computing an accumulator from scratch we can use it to // efficiently compute the accumulator backwards, until we get to a king // move. We expect that we will need these accumulators later anyway, so // computing them now will save some work.