rsz: `repair_timing -setup` main phase exits on "no TNS progress" with violating endpoints never visited
I maintainer di solito rispondono entro 1 giorno
@precisionmoon ci sta già lavorando.
Dal 3/12/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Description
repair_timing -setup can end its main (LEGACY) phase while endpoints with negative slack are still waiting in its endpoint list, unvisited. The remaining endpoints are repairable: calling repair_timing -setup again with the same arguments repairs them. The cause is how SetupLegacyBase::terminateProgress measures progress, described below from the source.
This was seen on a large private design, on global-route parasitics, with a positive -setup_margin. I cannot share the design, and I do not have a small public reproducer. The analysis below is from the source alone, so it can be checked without one.
Version
26Q4 tag (c4d317e4fa). The same logic is on master at f2bd51d859, apart from the guard discussed under "What master already covers".
Mechanism
All references are to src/rsz/src/policy/ at the 26Q4 tag.
-
The list is built once per phase.
SetupLegacyPolicy::initializeMainRepaircallscollectViolatingEndpoints(setup_slack_margin), which returns every endpoint with slack under the margin, sorted worst first (RepairTargetCollector::collectViolatingEndpoints,stable_sortby slack).runMainRepairLoopwalks that list in order. The list is not refreshed while the phase runs. -
Every visit costs an iteration, including a visit that does nothing.
repairEndpointincrementsmain_state.opto_iterationat the top of its loop and only then tests whether the endpoint already meets the margin ("Endpoint slack ... meets slack margin ..., done"). A fix made for an earlier endpoint often lifts later endpoints that share its logic. Each of those, when its turn comes, spends one iteration and changes nothing. -
Progress is the TNS gained per 100 iterations, as a fraction of the phase's starting TNS. In
SetupLegacyBase::terminateProgress:if (iteration % opto_large_interval_ == 0) { // 1000 fix_rate_threshold *= 2.0; // starts at inc_fix_rate_threshold_ = 0.0001 } if (iteration % opto_small_interval_ == 0) { // 100 float curr_tns = sta_->totalNegativeSlack(max_); float inc_fix_rate = (prev_tns - curr_tns) / initial_tns; prev_tns = curr_tns; if (iteration > 1000 && inc_fix_rate < fix_rate_threshold) { ... return true; } }initial_tnsis the TNS when the phase started. After iteration 1,000 the phase must gain 0.02% of that TNS in every 100 iterations, 0.04% after iteration 2,000, and so on. One failed check abandons the endpoint in work (restoreEndpointState); two failed checks in a row settwo_cons_terminationsandrunMainRepairLoopexits ("Exiting due to no TNS progress for two opto cycles"). -
Put together. On a design with several thousand endpoints in the list and a large starting TNS:
- The required gain is an absolute amount fixed by the size of the problem at the start. It does not shrink as the remaining TNS shrinks, and it doubles every 1,000 iterations.
- When the walk reaches a stretch of the list whose endpoints earlier fixes have already lifted, it spends one iteration on each and gains no TNS. Two hundred such endpoints in a row are two failed checks.
- The phase then exits. Everything later in the list is never visited, including endpoints that are still negative, because the list order is the slack order from before any repair.
- With a setup margin there is a second effect:
totalNegativeSlackis measured against zero, so lifting an endpoint from zero to the margin is not progress on this measure even though that endpoint is in the list.
In the case I saw, the main phase exited after visiting a minority of its list. Nearly every visited endpoint had ended "meets slack margin, done". WNS was still negative and most of the list was unvisited.
-
The later phases inherit the same measure.
SetupLastGaspPolicytakesinitial_tnsand the iteration counter from the sharedsetup_context_, so it is checked from its first hundredth iteration against the main phase's starting TNS, and exits the same way.
Why a second call succeeds
A second repair_timing -setup with the same arguments:
- collects and sorts a fresh list, so endpoints that already meet the margin are gone and the remaining negative ones are at the front;
- takes a fresh, much smaller starting TNS, so the same fraction is a small absolute amount;
- restarts the iteration counter, so no check runs during its first 1,000 iterations.
In the case I saw, the second call brought TNS to zero and a third brought every endpoint to the margin. Naming the main phase twice in -phases in one call does not have the same effect: the second LEGACY phase re-collects its list and its starting TNS, but the call's iteration counter carries over (setup_context_.iteration), so it is checked from its first hundredth iteration and exits early again.
Nothing on the command line reaches this rule. inc_fix_rate_threshold_, opto_small_interval_ and opto_large_interval_ are constants in SetupLegacyBase.hh; -max_iterations and -max_passes are caps only.
What master already covers
Master (f2bd51d859) adds this to terminateProgress:
// TNS only sees true violations. Once it is 0, any remaining work targets
// the setup slack margin, which the fix rate cannot measure.
if (config_.setup_slack_margin > 0.0f
&& (initial_tns >= 0.0f || curr_tns >= 0.0f)) {
prev_tns = curr_tns;
return false;
}
That fixes the exit once TNS has reached zero while endpoints remain between zero and the margin. It does not change the case in this issue, where TNS is still negative: the threshold is still a fraction of the phase's starting TNS, the list is still walked in its initial order, and already-met endpoints still spend iterations. The main loop in SetupLegacyPolicy.cc is the same on master.
Expected behavior
A phase should not exit on low progress while endpoints in its list that are still violating have not been visited, or at least should not count visits to already-met endpoints as failed progress.
Suggested direction
Any one of these would remove the early exit; they are listed from smallest change to largest.
- Do not count a visit that ends at the "meets slack margin" test as an iteration, or skip such endpoints before
beginEndpointRepair. Then a stretch of already-lifted endpoints cannot produce failed checks by itself. - Measure the gain against the TNS that remains (
prev_tns) instead of the phase's starting TNS, so the required rate follows the problem as it shrinks. - When two checks in a row fail, re-collect and re-sort the endpoint list and continue if the pass over the old list repaired anything; exit only when a whole pass gains nothing. This is what a second call does today.
- Use a margin-aware measure (the sum of slack under the margin, or the count of endpoints under it) in place of
totalNegativeSlack, which would also generalize the guard master added.
A smaller, separate point: giving each phase its own iteration baseline for the iteration > 1000 test would make a repeated phase in -phases behave like a repeated call.
How to observe
With set_debug_level RSZ repair_setup 1, the main phase prints "Exiting at iteration N because incr fix rate X% is < Y% [endpt i/n]" twice, 100 iterations apart, with i well below n, then "Exiting due to no TNS progress for two opto cycles". The command ends with [WARNING RSZ-0062] Unable to repair all setup violations. A second identical call then repairs endpoints the first one never visited.
Related
- #11746 added the guard quoted above.
- #11684 discusses ending a phase earlier, at its knee. This issue is the other side of the same rule: the current measure can end a phase before it has looked at endpoints that are still violating and cheap to fix.
- Lingua principale
- Verilog
- Stelle
- 3.3k
- Fork
- 1.1k
- Merge medio
- 3g 11h
- PR unite (30g)
- 247
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di The-OpenROAD-Project/OpenROAD
-
drt: min-area patch owner search compares the origin-relative patch box with absolute shapes, so patches are droppedForse già presa @bnmfw l’ha presa 11 giorni fa. Apertabug drt
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
The-OpenROAD-Project/OpenROAD#12191 · 5 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
odb LEF58_MINIMUMCUT: per-cut-class form never sets isPerCutClass, so drt silently drops the ruleForse già presa @LucasYuki l’ha presa 25 giorni fa. Apertabug drt odb
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
The-OpenROAD-Project/OpenROAD#12176 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
drt: LEF58_SPACING ENDOFLINE MINLENGTH l TWOSIDES is checked one-sided (io passes the TWOEDGES flag as TWOSIDES)Forse già presa @osamahammad21 l’ha presa 25 giorni fa. Apertabug drt
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
The-OpenROAD-Project/OpenROAD#12173 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
cleanup-opportunity: BUILD files never refer to mockturtle in third-partty/Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabazel enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 76/100
The-OpenROAD-Project/OpenROAD#12160 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
odb: Bazel build fails on linux/aarch64 — char fc compared to EOF in def/lef lexersForse già presa @shivarammysore l’ha presa 32 giorni fa. Apertabazel bug odb
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 80/100
The-OpenROAD-Project/OpenROAD#12095 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno