Use huge pages for worker data

As the worker data is quite large (28MB after #6350) we can make use of huge pages as a speedup.

prior to #6350

STC passed elo gaining bounds:
LLR: 2.95 (-2.94,2.94) <0.00,2.00>
Total: 166272 W: 43479 L: 42993 D: 79800
Ptnml(0-2): 540, 17598, 46365, 18102, 531
https://tests.stockfishchess.org/tests/view/68e9f3c0d323fd15c04e3ba4

Tested the speedup on a large machine with speedtest:
==== master ====
Average (over 20):  288644510
==== largePageWorker ====
Average (over 20):  292082422

Test after #6350:
==== rustam-cpp-testPR ====
Average (over 20):  291035351
==== rustam-cpp-testPR-pages ====
Average (over 20):  291937367

https://github.com/official-stockfish/Stockfish/pull/6359

No functional change
This commit is contained in:
Kieren Pearson
2025-10-11 17:04:06 +11:00
committed by Joost VandeVondele
parent 315f8ba4bf
commit 75edbee01e
3 changed files with 7 additions and 4 deletions
+1
View File
@@ -136,6 +136,7 @@ Ken Takusagawa
Kenneth Lee (kennethlee33)
kevlu8
Kian E (KJE-98)
Kieren Pearson (KierenP)
kinderchocolate
Kiran Panditrao (Krgp)
Kirill Zaripov (kokodio)
+3 -2
View File
@@ -26,6 +26,7 @@
#include <unordered_map>
#include <utility>
#include "memory.h"
#include "movegen.h"
#include "search.h"
#include "syzygy/tbprobe.h"
@@ -53,8 +54,8 @@ Thread::Thread(Search::SharedState& sharedState,
// the Worker allocation. Ideally we would also allocate the SearchManager
// here, but that's minor.
this->numaAccessToken = binder();
this->worker =
std::make_unique<Search::Worker>(sharedState, std::move(sm), n, this->numaAccessToken);
this->worker = make_unique_large_page<Search::Worker>(sharedState, std::move(sm), n,
this->numaAccessToken);
});
wait_for_search_finished();
+3 -2
View File
@@ -28,6 +28,7 @@
#include <mutex>
#include <vector>
#include "memory.h"
#include "numa.h"
#include "position.h"
#include "search.h"
@@ -93,8 +94,8 @@ class Thread {
void wait_for_search_finished();
size_t id() const { return idx; }
std::unique_ptr<Search::Worker> worker;
std::function<void()> jobFunc;
LargePagePtr<Search::Worker> worker;
std::function<void()> jobFunc;
private:
std::mutex mutex;