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

Đang mở
#11,587 5 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@jhkim-pii đang làm issue này rồi.

Từ ngày 30/9/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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

Ngôn ngữ chính
Verilog
Star
3.4k
Fork
1.1k
Merge trung bình
3 ngày 11 giờ
Pull request đã merge (30 ngày)
245

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của The-OpenROAD-Project/OpenROAD

Tất cả issue của The-OpenROAD-Project/OpenROAD

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.