reworked corrhist handling | bench 6409786

This commit is contained in:
rektdie committed 2025-09-10 01:26:42 +02:00
1 parent 3e652df8e8
commit 32691d2d65
5 files changed
+23 -11

No files matched your search

+13 -7
View File
@@ -52,10 +52,9 @@ class CorrHist {
private:
// indexed by [stm][key]
MultiArray<int, 2, CORRHIST_SIZE> pawnHist;
//MultiArray<int, 2, CORRHIST_SIZE> nonPawnHist;
public:
void UpdatePawnHist(Board& board, int depth, int diff) {
int* entry = &pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE];
void Update(Board& board, int depth, int diff, int* entry) {
const int scaledDiff = diff * CORRHIST_GRAIN;
const int newWeight = std::min(depth * depth + 2 * depth + 1, 128);
@@ -63,12 +62,19 @@ public:
*entry = std::clamp(*entry, -CORRHIST_MAX, CORRHIST_MAX);
}
int GetPawnHist(Board& board) {
return pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE];
void UpdateAll(Board& board, int depth, int diff) {
Update(board, depth, diff, &pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE]);
//Update(board, depth, diff, &nonPawnHist[board.sideToMove][board.nonPawnKey % CORRHIST_SIZE]);
}
void ClearPawnHist() {
int GetAllHist(Board& board) {
return pawnHist[board.sideToMove][board.pawnKey % CORRHIST_SIZE];
// + nonPawnHist[board.sideToMove][board.nonPawnKey % CORRHIST_SIZE];
}
void Clear() {
std::fill(&pawnHist[0][0], &pawnHist[0][0] + sizeof(pawnHist) / sizeof(int), 0);
//std::fill(&nonPawnHist[0][0], &nonPawnHist[0][0] + sizeof(nonPawnHist) / sizeof(int), 0);
}
};
@@ -188,7 +194,7 @@ public:
pvLine.Clear();
history.Clear();
conthist.Clear();
corrhist.ClearPawnHist();
corrhist.Clear();
TT.Clear();
sw.Restart();
killerMoves = {};