Full relevelization on every repeater insertion makes repair_design quadratic on loop-heavy netlists

Aperta
#11,587 5 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@jhkim-pii ci sta già lavorando.

Dal 30/9/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

Describe the bug

Summary

On netlists with many combinational loops (flat, unprogrammed FPGA fabrics), OpenROAD's timing-driven global_placement spends most of its time in Levelize::findLevels. Each repeater inserted by repair_design appears to trigger a full relevelization, so the cost grows with (buffers inserted) × (graph size).

Evidence

All 4 of 4 gdb samples of the main thread, taken during the first timing-driven repair_design inside global_placement, are in this chain:

RepairDesign::makeRepeater
 -> Resizer::resizeToTargetSlew
 -> EstimateParasitics::ensureWireParasitic
 -> EstimateParasitics::estimateWireParasiticSteiner
 -> EstimateParasitics::isIdealClockPin
 -> Sta::isClock -> Sta::ensureClkNetwork -> Sta::ensureLevelized
 -> Levelize::findLevels -> findBackEdges -> recordLoop -> loopEdges

Scale, on Nangate45 with ORFS defaults:

design nets global placement wall time
6x6 fabric 246k 4 h 58 min of a 5 h 40 min flow
8x8 fabric 550k first of two timing-driven passes unfinished after 9 h

The same fabric placed tile-by-tile (a few thousand nets per tile) shows no such slowdown.

Trigger (measured)

A full findLevels runs only when levelized_ is false. During repair_design, the only thing that cleared it was Levelize::deleteEdgeBefore on an edge in loop_edges_:

// Relevelize if a loop edge is removed. Incremental levelization
// fails because the DFS path will be missing.
levelized_ = false;

Counts from sta::set_debug levelize 2 over one repair_design on the smallest (4x4, 65k nets) fabric, starting from the pre-global-placement ODB:

event count
buffers inserted / nets repaired 458 / 296
delete loop edge 62
full levelize (findLevels) 62
levels invalid (Levelize::invalid) 0
relevelize from (incremental) 10,784

So about one in five repaired nets carries a loop-breaking edge, and each of those buffers costs a full relevelization, including recordLoop for every loop in the design. Both the number of such nets and the cost of each relevelization grow with design size.

Question

Could deleting a loop edge be handled incrementally, for example by treating the new driver/load vertices as relevelizeFrom roots and re-running loop detection only in the affected fanout cone? Alternatively, could isClock/isIdealClock avoid forcing a full relevelization when only levels, not the clock network, are stale? We can share an ODB + SDC reproducer.

Measured on OpenSTA 14751996 (2026-05-28) inside OpenROAD 9b75dd85eb (2026-06-03). By code reading, current master still behaves this way: OpenSTA 5adf472 (2026-09-29) deleteEdgeBefore still clears levelized_ and findLevels → clear() → clearLoopEdges() resets back_edges_valid_, so ensureBackEdges() re-runs findBackEdges; OpenROAD master EstimateParasitics still calls isClock/isIdealClock per wire estimate.

Expected Behavior

Repeater insertion in repair_design should cost roughly the same per buffer whether or not the repaired net carries a loop-breaking edge. Deleting a loop edge should relevelize only the affected fanout cone, like the incremental relevelizeFrom path already does for ordinary edge changes. It should not trigger a full findLevels (with findBackEdges/recordLoop over every loop in the design) once per buffer.

On the 4x4 case above, that means the 62 full levelizations in one repair_design should be incremental updates. global_placement runtime on loop-heavy flat netlists should then scale with the number of repaired nets rather than (repaired nets) × (graph size). For reference, the same fabric placed tile-by-tile takes minutes where the flat run takes hours.

Environment
see bug description
To Reproduce
  1. Load the pre-global-placement ODB + SDC of a flat FPGA fabric (many combinational loops); a reproducer can be shared.
  2. sta::set_debug levelize 2
  3. Run repair_design.
  4. Count delete loop edge and full levelize messages: each loop-edge deletion is followed by a full findLevels.
Relevant log output

Screenshots

No response

Additional Context

No response

Lingua principale
Verilog
Stelle
3.4k
Fork
1.1k
Merge medio
3g 11h
PR unite (30g)
245

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di The-OpenROAD-Project/OpenROAD

Tutte le issue di The-OpenROAD-Project/OpenROAD

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.