Skip to content

Conversation

@KierenP
Copy link
Contributor

@KierenP KierenP commented Oct 14, 2025

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

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

@vondele tested the speedup on a large machine:

==== master ====
Average (over 20):  288644510
==== largePageWorker ====
Average (over 20):  292082422

Which shows approximately a 1.2% speedup

It was speculated that if the worker size was increased, the speedup would become more pronounced. To test this, @vondele tested this patch on top of another (#6350) which increased the worker size to 28MB:

==== rustam-cpp-testPR ====
Average (over 20):  291035351
==== rustam-cpp-testPR-pages ====
Average (over 20):  291937367

Which shows only a 0.3% speedup. This was not the anticipated result, but could simply be due to noise in the speed test.

Bench: 2169281

@KierenP KierenP changed the title Worker data huge pages Use huge pages for worker data Oct 14, 2025
@vondele vondele added 🚀 gainer to be merged Will be merged shortly labels Oct 14, 2025
@vondele vondele requested a review from Copilot October 14, 2025 15:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR switches worker allocations to use huge pages for potential performance gains and adds the contributor to AUTHORS.

  • Replace std::unique_ptr with LargePagePtr for Worker in Thread
  • Allocate Worker via make_unique_large_page within the NUMA-bound context
  • Add include of memory.h where needed and update AUTHORS

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/thread.h Switch worker type to LargePagePtr and include memory.h to support huge page allocation.
src/thread.cpp Use make_unique_large_page to allocate Worker and include memory.h.
AUTHORS Add new contributor entry.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

vondele pushed a commit that referenced this pull request Oct 14, 2025
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
@vondele
Copy link
Member

vondele commented Oct 14, 2025

merged with 75edbee

@vondele vondele closed this Oct 14, 2025
MinetaS pushed a commit to MinetaS/Stockfish that referenced this pull request Oct 21, 2025
As the worker data is quite large (28MB after official-stockfish#6350) we can make use of huge pages as a speedup.

prior to official-stockfish#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 official-stockfish#6350:
==== rustam-cpp-testPR ====
Average (over 20):  291035351
==== rustam-cpp-testPR-pages ====
Average (over 20):  291937367

official-stockfish#6359

No functional change
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀 gainer to be merged Will be merged shortly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants