instrument: TT lookup/hit counters (hot-path) + env-gated summary - #365
instrument: TT lookup/hit counters (hot-path) + env-gated summary#365wopdevries wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
It introduces compilation fragility (missing direct standard includes) and a real stats correctness issue (new PageStats fields aren’t reset on TT teardown).
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR adds lightweight instrumentation to measure transposition-table (TT) effectiveness on the alpha-beta search hot path, and reports an environment-gated summary at solver completion to support TT sizing/tuning work.
Changes:
- Added per-
ThreadDataTT probe counters (tt_lookup_count,tt_hit_count) and incremented them inapply_ab_tt_lookup. - Added env-gated (
DDS_PRINT_TT_STATS) stderr summary printing on solver completion paths. - Extended
TransTableL::PageStatswith insertion/overwrite counters and incremented them on TT entry creation/overwrite.
File summaries
| File | Description |
|---|---|
| library/src/trans_table/trans_table_l.hpp | Extends PageStats with add/overwrite counters. |
| library/src/trans_table/trans_table_l.cpp | Initializes new PageStats fields; increments add/overwrite counters in create_or_update. |
| library/src/system/thread_data.hpp | Adds per-thread TT lookup/hit counters to ThreadData. |
| library/src/solver_if.cpp | Resets counters per solve and prints env-gated TT hit-rate summary at completion. |
| library/src/ab_search.cpp | Increments TT lookup/hit counters in the canonical TT probe path. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
There are a few concrete mismatches and consistency issues (notably the env var gating contract and documentation/formatting inconsistencies) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
library/src/trans_table/trans_table_l.hpp:477
- This inline override uses same-line braces; please reformat it to match the Allman function brace style used throughout the codebase.
auto get_op_stats(int& adds, int& overwrites, int& harvests) const -> void override {
adds = page_stats_.num_adds_;
overwrites = page_stats_.num_overwrites_;
harvests = page_stats_.num_harvests_;
}
- Files reviewed: 8/8 changed files
- Comments generated: 6
- Review effort level: Lite
| } | ||
|
|
||
| // Print TT stats if requested | ||
| if (std::getenv("DDS_PRINT_TT_STATS")) { |
| auto reset_op_stats() -> void override { | ||
| page_stats_.num_adds_ = 0; | ||
| page_stats_.num_overwrites_ = 0; | ||
| page_stats_.num_harvests_ = 0; | ||
| } |
Minimal, low-risk instrumentation to measure the transposition-table hit rate on the search hot path.
Changes:
tt_lookup_countandtt_hit_countcounters toThreadDataapply_ab_tt_lookup(the canonical AB hot-path TT probe)SOLVER_DONEwhenDDS_PRINT_TT_STATS=1No behavioral changes — counters are cheap increments, output is gated.
Measurement results on
hands/largest.txt(21 hardest hands, single-threaded):Updated findings after per-solve reset fix:
How to test: