chrisw wrote: ↑Tue Nov 29, 2022 6:14 pm
How much do large pages help chess engines?
Running depth 26 bench in my engine on a Windows machine with permission to use large pages enabled and using 1024MB hash tables.
1. Usage of large pages disabled by UCI option:
So we have 17% more speed under these conditions.
With 256MB hash and a depth 24 bench I measured only 5% more speed with large pages enabled compared to disabled, so the advantage depends on the conditions.
Thanks! Needless to say, I rushed off to see how to get this done (POV Windows 10 system). First sight, it seems fairly tortuous to persuade Windows. Spun through the Microsoft script linked to on SF pages, but ran into problem of “who” to enable, the script seemed to be for an SQL server. It also recommended using RamMap, but that just hung. It’s not that I’m not sure what I’m doing wrong, more a case of not knowing what I’m doing, as ever.
For Windows, it doesn’t seem like the engine code needs anything done at all, so I wondered how you disabled it with UCI. Checked quickly the Rubichess code on GitHub but couldn’t see the UCI option. So, confused ….
Modern Times wrote: ↑Tue Nov 29, 2022 12:09 am
I may be wrong, but I think once they are allocated you don't lose them. There is some ambiguity in that wording. Maybe someone else knows for sure.
Thanks
I think the setting remains but for how long "large pages" can be efficiently used without reboots, I'm not sure. I've since found the following link:
It's not chess specific but it does highlight a potential issue. I'm going to monitor performance in combination with doing some reboots periodically.
If the engine remains running, you will not lose the large pages.
If you stop the engine and restart it almost immediately, it should normally find back the large pages that were just deallocated.
If you have been running all kinds of applications on your computer since you last rebooted, memory might have become too fragmented for Windows to find enough large pages when you start the chess engine. Ideally the chess engine will report whether allocating large pages succeded. More ideally, you run Linux which will transparenty shuffle things around to give you the large pages you want.
It is possible that Windows 11 has improved on this point (but I have no information about this).
chrisw wrote: ↑Wed Nov 30, 2022 6:18 pm
Thanks! Needless to say, I rushed off to see how to get this done (POV Windows 10 system). First sight, it seems fairly tortuous to persuade Windows. Spun through the Microsoft script linked to on SF pages, but ran into problem of “who” to enable, the script seemed to be for an SQL server. It also recommended using RamMap, but that just hung. It’s not that I’m not sure what I’m doing wrong, more a case of not knowing what I’m doing, as ever.
chrisw wrote: ↑Wed Nov 30, 2022 6:18 pm
For Windows, it doesn’t seem like the engine code needs anything done at all, so I wondered how you disabled it with UCI. Checked quickly the Rubichess code on GitHub but couldn’t see the UCI option. So, confused ….
The only reason for this UCI option (besides that I could use it for this thread) is to avoid that in RubiX-RubiY tests with quite large Hash settings, one engine gets the large pages and the other fails to alloc with large pages. That would destroy the test and so I always set "Allow Large Pages" to false when running tests on my Windows machine.
chrisw wrote: ↑Wed Nov 30, 2022 6:18 pm
Thanks! Needless to say, I rushed off to see how to get this done (POV Windows 10 system). First sight, it seems fairly tortuous to persuade Windows. Spun through the Microsoft script linked to on SF pages, but ran into problem of “who” to enable, the script seemed to be for an SQL server. It also recommended using RamMap, but that just hung. It’s not that I’m not sure what I’m doing wrong, more a case of not knowing what I’m doing, as ever.
chrisw wrote: ↑Wed Nov 30, 2022 6:18 pm
For Windows, it doesn’t seem like the engine code needs anything done at all, so I wondered how you disabled it with UCI. Checked quickly the Rubichess code on GitHub but couldn’t see the UCI option. So, confused ….
The only reason for this UCI option (besides that I could use it for this thread) is to avoid that in RubiX-RubiY tests with quite large Hash settings, one engine gets the large pages and the other fails to alloc with large pages. That would destroy the test and so I always set "Allow Large Pages" to false when running tests on my Windows machine.
chrisw wrote: ↑Tue Nov 29, 2022 6:14 pm
How much do large pages help chess engines?
Why?
How?
About 10%. The system performance increase stems from the reduction of translation lookaside buffer (TLB) misses due to the ability of the TLB to map to a larger virtual memory range. It also speeds up memory prefetching by eliminating the need to restart prefetch operations on 4 KB boundaries.
Speed increases are more noticeable when using 2048 GB hash sizes or larger.