Repository navigation
A release about threads. Until now only the main search used more than one: the looks that come after it (Tal's look, which takes a second, longer look at a sacrifice the main search turned down, and the rescue look, which hunts for a way out of a lost endgame) ran on a single thread while the others sat idle.
Thanks to ChessVision
The idea and the first working version come from awne8886, who builds AggroChess into ChessVision, a Firefox add-on, and in its version 2.0.9 put helper threads into Tal's look and the rescue look. Thank you! AggroChess 4.7.0 is our own take on it, written for the desktop engine and tested on its own; any mistakes in it are ours.
What changed
With Threads above 1 (the default is 8):
- Tal's look: helper threads search each sacrifice alongside the look, sharing its hash table (Lazy SMP, as the main search does). The table grows with the helpers, up to four times its usual 16 MB, so they don't crowd each other out.
- The rescue look: the moves that give material back are searched side by side instead of one after another, each by its own search with the usual 64 MB table (256 MB in all at most). Each look takes, when it starts, its share of the time left, so a look that finds a mate fast leaves its time to the others. The swindle step no longer runs after a rescue look on several threads: it used to get the time the looks left over and overrule their verdict.
- The quick filter and the quiet-try scan of Tal's look run their short searches side by side.
With Threads 1 nothing changes: same moves, same node count. aggro_chess bench still prints 170599 nodes.
Test results
The twelve studies and the twelve classics (tests/famous.epd), 30 seconds, 4 threads, v4.6.1 and v4.7.0 running at the same time on a 12-thread PC, 3 runs:
| Run 1 | Run 2 | Run 3 | Total | |
|---|---|---|---|---|
| v4.6.1 | 21 | 22 | 22 | 65 / 72 |
| v4.7.0 | 23 | 22 | 21 | 66 / 72 |
The total hardly moves, but which studies get solved does. Over 12 runs of each (this test and three earlier ones while the change was being finished):
| Study | v4.6.1 | v4.7.0 |
|---|---|---|
| Amann's study, 1.Qd8!! | 3 / 12 | 11 / 12 |
| Study #2, 1.Nc6!! | 6 / 12 | 12 / 12 |
| Topalov-Shirov 1998, 47...Bh3!! | 7 / 12 | 11 / 12 |
| Greek gift in the Colle, 11.Bxh7+ | 12 / 12 | 6 / 12 |
| Study #3, 1.Rxh1!! | 12 / 12 | 4 / 12 (2 / 3 with the final build) |
The two losses come from looking deeper, not from a mistake in the threads. On 11.Bxh7+ the longer look reaches depth 20, where it finds Black's defence (...Rh8 and ...Kg8) and scores the sacrifice about level with the quiet moves, so it is no longer played. On 1.Rxh1!! the deeper rescue look sees 1...Nxh1 2.e6 and scores the stalemate fortress as lost, which it is not: v4.6.1 played the move from a shallower line where Black doesn't take the rook. The engine's evaluation doesn't know that fortress, and a deeper search shows that.
The 1-thread criterion (30 s, 1 thread) is unchanged, since one thread searches exactly as v4.6.1 did.
Against v4.6.1 at 60 s + 0.6 s, 2 threads each, 20 balanced openings from both sides, with a build from partway through (before the swindle change and the bigger tables): 17 / 4 / 19 (47.5%, within the noise of 40 games), with a sacrifice by AggroChess in 40 of 40 games.
Downloads
aggro_chess.exe: Windows x64. SHA-256:dd787ce8274067c5c8dd12e247467127b864d37d0025dc284deb5a40c7536e56aggro_chess-linux-x86_64: Linux x64 (a static build that needs nothing installed). Runchmod +x aggro_chess-linux-x86_64once. SHA-256:f9266da83dd85996ff4f00d32e24d652426d18fb839f3879849479488397fc22AggroChess-4.7.0-wasm.zip: the WebAssembly build for web projects, with a README and an example worker. It runs on one thread, so it plays exactly as 4.6.1's did. SHA-256:3508c107c998af229f4ab8899371d9cf30a9abd160648eb38cf5f81f339b4257