Skip to content

Commit 75edbee

Browse files
KierenPvondele
authored andcommitted
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 #6359 No functional change
1 parent 315f8ba commit 75edbee

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ Ken Takusagawa
136136
Kenneth Lee (kennethlee33)
137137
kevlu8
138138
Kian E (KJE-98)
139+
Kieren Pearson (KierenP)
139140
kinderchocolate
140141
Kiran Panditrao (Krgp)
141142
Kirill Zaripov (kokodio)

src/thread.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#include <unordered_map>
2727
#include <utility>
2828

29+
#include "memory.h"
2930
#include "movegen.h"
3031
#include "search.h"
3132
#include "syzygy/tbprobe.h"
@@ -53,8 +54,8 @@ Thread::Thread(Search::SharedState& sharedState,
5354
// the Worker allocation. Ideally we would also allocate the SearchManager
5455
// here, but that's minor.
5556
this->numaAccessToken = binder();
56-
this->worker =
57-
std::make_unique<Search::Worker>(sharedState, std::move(sm), n, this->numaAccessToken);
57+
this->worker = make_unique_large_page<Search::Worker>(sharedState, std::move(sm), n,
58+
this->numaAccessToken);
5859
});
5960

6061
wait_for_search_finished();

src/thread.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <mutex>
2929
#include <vector>
3030

31+
#include "memory.h"
3132
#include "numa.h"
3233
#include "position.h"
3334
#include "search.h"
@@ -93,8 +94,8 @@ class Thread {
9394
void wait_for_search_finished();
9495
size_t id() const { return idx; }
9596

96-
std::unique_ptr<Search::Worker> worker;
97-
std::function<void()> jobFunc;
97+
LargePagePtr<Search::Worker> worker;
98+
std::function<void()> jobFunc;
9899

99100
private:
100101
std::mutex mutex;

0 commit comments

Comments
 (0)