perf(tbr): finish T-300 — incremental rescore for TBR-rerooting accepts - #47
Open
ms609 wants to merge 1 commit into
Open
perf(tbr): finish T-300 — incremental rescore for TBR-rerooting accepts#47ms609 wants to merge 1 commit into
ms609 wants to merge 1 commit into
Conversation
T-300's SPR half landed long ago (f531bbc EW, 014ccde NA); what issue #38 still describes as "full_rescore after every accepted move" is now only the residue: accepts that rerooted the clipped fragment, which still fell through to full_rescore. apply_tbr_move reverses the parent/child links along clip_node..reroot_parent, so every node on that path gains new children — and after the reversal that path IS clip_node's rootward chain. One extra dirty seed at clip_node therefore covers the rerooting case exactly, with no new machinery: the NA kernel already took a third seed for precisely this region (it backs exact_verify_sweep), so this only adds the same parameter to the EW/IW kernel and drops the is_spr gate at the accept site. Measured, and the honest answer is that the lever is spent. Post-T-300 the whole accept branch is 0.18-0.51% of tbr_search wall (in-DLL na_t_accept_ms, Vinther2008/Agnarsson2004/Zanol2014 x EW,IW, 15 paired cells). This cuts that slice to x0.901 median (12/15 cells) => ~0.03% end-to-end, i.e. undetectable. Rerooting accepts are ~18% of accepts, so that is a real ceiling, not thin coverage. The case for merging is codepath unification, not speed; area 4 is recorded AT-LIMIT so it is not profiled again. Correctness, given an earlier incremental attempt shipped a systematic delta=-3 (b7303ee): - TS_TBR_ACCEPTCHK, a new env-gated in-flight oracle, cross-checks every incremental accept against full_rescore and aborts on drift. Clean over the 70-cell battery (1322 accepts) and over 624 assertions spanning the constrained, pool, IW, XPIWE, sector and drift paths. - Scores and accept counts are byte-identical to the pre-patch library across all 15 A/B cells and the 70-cell battery, so trajectories are unchanged. - n_reroot_accepts (src/ts_data.h) makes the new regression test non-vacuous: the four pre-existing tests assert score identity but cannot tell whether the rerooting arm was ever entered, so the new one asserts coverage as well as correctness. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Author
|
🟢 on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #38
What was actually left
Most of #38 was already done. T-300 landed its SPR half long ago (
f531bbcdEW,014ccdeaNA), so the issue text — and its line numbers (ts_tbr.cpp:1134) — describe code that no longer exists. The residue was accepts that rerooted the clipped fragment: those still fell through tofull_rescore.apply_tbr_movereverses the parent/child links alongclip_node..reroot_parent, so every node on that path gains new children — and after the reversal that path isclip_nodes rootward chain. One extra dirty seed atclip_nodetherefore covers the rerooting case exactly, with no new machinery: the NA kernel already took a third seed for precisely this region (it backsexact_verify_sweep), so this adds the same parameter to the EW/IW kernel and drops theis_sprgate at the accept site.Read this before merging: the lever is spent
tbr_searchwallPost-T-300 the whole accept branch is 0.18–0.51 % of
tbr_searchwall (in-DLLna_t_accept_ms, 15 paired cells, arms interleaved because the box is shared). This patch cuts that slice to ×0.901 median (faster in 12/15 cells) ⇒ ≈0.03 % end-to-end — undetectable.Rerooting accepts are ~18 % of accepts, so that ceiling is real, not thin coverage. The case for merging is codepath unification, not speed — one fewer special case, and the accept path now shares its dirty region with
exact_verify_sweep. If you would rather not touch a correctness-critical hot path for no measurable gain, closing this unmerged is a reasonable call; the measurement is the durable part and is recorded either way.dev/profiling/findings.mdandfocus-areas.mdnow mark area 4 AT-LIMIT, and flag that the T-300 rows "19.2 % of NA-path DLL CPU" is the pre-fix number so it is not re-read as a live target.Correctness
An earlier incremental attempt shipped a systematic
delta = -3(b7303ee5), so this is evidenced rather than argued:TS_TBR_ACCEPTCHK— new env-gated in-flight oracle: cross-checks every incremental accept againstfull_rescoreand aborts on drift. Clean over a 70-cell battery (1322 accepts) and over 624 assertions spanning the constrained, pool, IW, XPIWE, sector and drift paths.n_reroot_accepts(src/ts_data.h) is asserted positive for each of EW / IW / NA / NA-IW, so losing coverage fails the test instead of silently voiding it.CI
ubuntu-arm64green (fullR CMD check).windowsfails, and it fails identically oncpp-search— I dispatched a control run (30909722952) to check rather than assume: same job, same step (Set up R dependencies,Cant find package called MaxMin),R CMD checkskipped. Pre-existing infrastructure breakage, nothing to do with this branch.🤖 Generated with Claude Code