RFC: repair_timing, a user callback to end a phase at its knee
I maintainer di solito rispondono entro 1 giorno
@jhkim-pii ci sta già lavorando.
Dal 9/10/2026.
Valutazione
Questa issue non è ancora stata valutata.
Descrizione
Today's repair_timing policy can be a Pyrrhic victory: repair grinds out the last picosecond, and the time it costs is paid for in design iterations that never happen. Running time is QoR.
A request for comments.
Description
repair_timing can be most of a build, and most of that comes after it has stopped making progress. On a larger design, that means fewer iterations on the design's own parameters (floorplan, RTL, constraints) in a day, and so worse QoR in the end.
On ORFS's asap7 designs, from repair_timing -verbose:
| design | repair_timing share of stage time | progress rows after the knee | WNS given up there |
|---|---|---|---|
| coralnpu | 68 % (2,702 of 3,989 s) | 83 % | 1.6 ps |
| ibex | 86 % (932 of 1,086 s) | 83 % | 1.8 ps |
| picorv32 (3 seeds) | 58–67 % | 88–93 % | ≤ 1.2 ps |
| riscv32i | 62 % | 93 % | 1.1 ps |
| swerv_wrapper | 9 % | 64 % | 0 ps |
| cva6 | 19 % | 92 % | 6.9 ps |
"After the knee" is where a per-phase plateau rule would have ended the phase: best WNS gains < 0.5 ps and TNS < 1 % over the last 20 progress rows. A progress row is a line of -verbose output, printed every so many iterations; an iteration is a unit of repair work. The table counts rows, because the log has nothing else, so the time saved is an estimate: the logs carry no timestamps, and rows are not all equally expensive.
What happens today. Each setup phase stops on terminateProgress: every 100 iterations it compares the TNS fixed since the last check with 0.01 % of the initial TNS, a threshold that doubles every 1,000 iterations, and it never stops before iteration 1,000. WNS plays no part. Beyond that there are blind caps (-max_iterations, -max_passes) and knobs that need the answer up front (-setup_margin, -repair_tns).
Why it is like this (Chesterton's fence). The stop is conservative on purpose. Progress is not monotonic, so a plateau does not mean the end:
- In coralnpu's CTS repair the main phase reaches 80 % of its WNS gain in the first 10 % of rows and then gains nothing for 42 % of rows. Then last gasp takes WNS from −46.6 to −35.0 ps in a few rows.
- cva6 gains late: the rule above costs it 6.9 ps.
A stop that comes too early and misses closure costs a tape-out; grinding costs compute. With closure as the goal, grinding is the safe default.
It is a hard problem, and an old one. Deciding when an optimizer has done enough is the stopping criterion of simulated-annealing placement [1], what METRICS set out to learn from measured runs [2], "doomed run" prediction with graph learning on industrial flows [3], and one of Kahng's open challenges, because today humans make that call [4]. Outside EDA, early stopping is the core of hyperparameter search [5]. Commercial tools now spend machine learning and many machines on the same trade-off [6]. People keep trying because the payoff is large.
I tried this before without applying Chesterton's fence, with predictable results: a built-in effort level (#10900, PR #10942) and a futility stop (PR #10248). The objection there stands: not everyone agrees how much effort to spend.
Suggested Solution
A strawman, for comments, not a recommendation: something concrete to pick apart. The best idea I have so far is a general user callback, a native Tcl or Python procedure, that makes the low-frequency stopping decision, while everything high-frequency stays in C++.
- Invocation is decoupled from logging. Progress rows are logged at uneven intervals of iterations, sometimes so far apart that the callback should have been asked several times in between. The callback is called every N iterations of work (its own cadence), not at log rows.
- It gets two dictionaries: read-only state from C++ (phase, iteration, WNS, TNS, violators, moves, area, ...), and a mutable state dictionary of its own, kept between calls; plus its parameters.
- It returns
continue,next_phaseorstop, with a reason that is logged. - The decision is per phase: stopping all of repair at the first plateau would have given up coralnpu's last-gasp 11 ps.
- The inputs are QoR only, so results stay deterministic.
- Today's behaviour becomes the default, overridable. The existing
terminateProgressrule is the default stopping policy, and today's progress rows the default logging cadence; a user can override either, independently. Without an override, nothing changes.
In the flow it is a variable, say REPAIR_TIMING_POLICY_TCL in ORFS-based flows (make or Bazel), naming the file that defines the rule. Rules start specific to a PDK and a design, written by whoever knows them, and are removed for a sign-off run. A small library of reusable rules may emerge from them; and who knows, a dominant one might emerge that experience can promote to the default. A smaller step in the same direction: expose terminateProgress's thresholds per phase, for WNS as well as TNS, as @minjukim55 suggested in #10900. (-policy is already an alias for -phases, so the callback needs another name.)
The case against. A user policy may need retuning when OpenROAD changes repair; if the change is an improvement, that is a good problem to have. And there is something to be said for having no policy and leaving it all to OpenROAD: a user policy does not dominate, or OpenROAD would already have had one or offered the options. Comments welcome on whether a callback is the right shape, what it gets wrong, or whether there is a better one.
Additional Context
Reproduce: any ORFS asap7 design above. Read the WNS and TNS columns of repair_timing -verbose in 4_1_cts.log and 5_1_grt.log in log order; the iteration counter restarts per phase, marked * for the main phases and + for last gasp.
[1] M. D. Huang, F. Romeo, A. Sangiovanni-Vincentelli, "An efficient general cooling schedule for simulated annealing", ICCAD 1986.
[2] S. Fenstermaker, D. George, A. B. Kahng, S. Mantik, B. Thielges, "METRICS: a system architecture for design process optimization", DAC 2000. https://vlsicad.ucsd.edu/Publications/Conferences/112/c112.pdf
[3] Y.-C. Lu, S. Nath, V. Khandelwal, S. K. Lim, "Doomed run prediction in physical design by exploiting sequential flow and graph learning", ICCAD 2021. https://gtcad.gatech.edu/www/papers/iccad21-1.pdf
[4] A. B. Kahng, "Reducing time and effort in IC implementation: a roadmap of challenges and solutions", DAC 2018. https://vlsicad.ucsd.edu/Publications/Conferences/360/c360.pdf
[5] L. Li, K. Jamieson, G. DeSalvo, A. Rostamizadeh, A. Talwalkar, "Hyperband: a novel bandit-based approach to hyperparameter optimization", JMLR 18, 2018. https://jmlr.org/papers/v18/16-558.html
[6] For example Synopsys DSO.ai: https://www.synopsys.com/blogs/chip-design/enhancing-chip-design-with-ai.html
- Lingua principale
- Verilog
- Stelle
- 3.4k
- Fork
- 1.1k
- Merge medio
- 3g 11h
- PR unite (30g)
- 245
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
-
odb LEF58_MINIMUMCUT: per-cut-class form never sets isPerCutClass, so drt silently drops the ruleForse già presa @LucasYuki l’ha presa 26 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 26 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
-
syn: acd_resynth -apply segfaults on a database resynthesized in an earlier processForse di nuovo libera @povik l’ha presa 31 giorni fa e non c’è nessuna pull request aperta. Apertabug syn
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
The-OpenROAD-Project/OpenROAD#12046 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno