RFC: repair_timing, a user callback to end a phase at its knee
维护者通常 1 天内回复
@jhkim-pii 已经在做这个了。
开始于 2026年10月9日。
评估
这个 Issue 还没有评估数据。
描述
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
- 主要语言
- Verilog
- 星标
- 3.4k
- 派生
- 1.1k
- 平均合并
- 3 天 11 小时
- 30 天内合并 PR
- 245
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
The-OpenROAD-Project/OpenROAD 的其他 Issue
-
odb LEF58_MINIMUMCUT: per-cut-class form never sets isPerCutClass, so drt silently drops the rule可能已有人在做 @LucasYuki 于 26 天前认领。 未关闭bug drt odb
难度 2/5 1-3 小时 新手友好度 85/100
The-OpenROAD-Project/OpenROAD#12176 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
drt: LEF58_SPACING ENDOFLINE MINLENGTH l TWOSIDES is checked one-sided (io passes the TWOEDGES flag as TWOSIDES)可能已有人在做 @osamahammad21 于 26 天前认领。 未关闭bug drt
难度 2/5 1-3 小时 新手友好度 82/100
The-OpenROAD-Project/OpenROAD#12173 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
cleanup-opportunity: BUILD files never refer to mockturtle in third-partty/可能重新可做 关联的 PR 已关闭且未合并。 未关闭bazel enhancement
难度 1/5 1 小时以内 新手友好度 76/100
The-OpenROAD-Project/OpenROAD#12160 · 4 条评论 ·
维护者通常 1 天内回复
-
odb: Bazel build fails on linux/aarch64 — char fc compared to EOF in def/lef lexers可能已有人在做 @shivarammysore 于 33 天前认领。 未关闭bazel bug odb
难度 1/5 1 小时以内 新手友好度 80/100
The-OpenROAD-Project/OpenROAD#12095 · 2 条评论 ·
维护者通常 1 天内回复
-
syn: acd_resynth -apply segfaults on a database resynthesized in an earlier process可能重新可做 @povik 于 31 天前认领,目前没有进行中的 PR。 未关闭bug syn
难度 2/5 1-3 小时 新手友好度 77/100
The-OpenROAD-Project/OpenROAD#12046 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复