mcts: remove the value hash (MCGS variant 5c)
The graph shares a position's node, and with it its Q, between move orders, which the value hash did for the tree. It still took 1/32 of Hash and a store for every node of every playout path (about 6 % of playout time in step 1). Its remaining use was positions the graph dropped in a collection, or a new search without reuse. All of Hash now goes to the graph. A simplification: Non-Regression SPRT. The bench changes slightly (one Searcher runs all 16 bench positions, so the value hash carried a few values between them). Checked: zero warnings; VERIFY build: `verify` (a)-(d), the VERIFY searches of plan section 6 with forced GC at Hash 1 and 2, the reuse sequence at Hash 64, Hash 1 and from the 960 start, and the go nodes 1/2, go depth 1 smoke positions. Bench: 765326 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95e49098ec
commit
9e7c3ef64a
2 files changed
+5
-53
No files matched your search
@@ -543,10 +543,6 @@ u32 Searcher::create_node(const Position& pos, bool is_root, float& value) {
|
||||
} else if (!is_root && pos.insufficient_material()) {
|
||||
node.state = TERMINAL_DRAW;
|
||||
value = 0.0f;
|
||||
} else if (float q; value_hash_.probe(pos.key, q)) {
|
||||
// A position searched before (dropped by a collection, or from an
|
||||
// earlier search) brings its Q along.
|
||||
value = q;
|
||||
} else {
|
||||
value = eval::value(pos);
|
||||
}
|
||||
@@ -728,10 +724,6 @@ void Searcher::playout() {
|
||||
node.visits++;
|
||||
node.base++;
|
||||
}
|
||||
if (leaf == NEW_NODE || leaf == TERMINAL || leaf == NOT_EXPANDED) {
|
||||
const Node& node = tree_.node(path_.back());
|
||||
value_hash_.store(node.key, -node.q, node.visits);
|
||||
}
|
||||
|
||||
// Up the path: each edge counts the visit (and the draw), and its parent
|
||||
// node recomputes its Q from its children. `value` is from the view of
|
||||
@@ -749,8 +741,6 @@ void Searcher::playout() {
|
||||
Node& node = tree_.node(path_[j]);
|
||||
node.visits++;
|
||||
recompute_q(node);
|
||||
// The Q from the view of the side to move at the node.
|
||||
value_hash_.store(node.key, -node.q, node.visits);
|
||||
}
|
||||
|
||||
iterations_++;
|
||||
|
||||
Reference in new issue
Block a user