Repository navigation
rsz: bail repair_timing on obviously-futile designs #10248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
64e7365
rsz: bail repair_timing on obviously-futile designs
oharboe a732ba9
rsz: address PR 10248 review nits
oharboe 41913a6
Update src/rsz/src/RepairSetup.cc
oharboe 8e5b2f2
Update src/rsz/src/RepairSetup.cc
oharboe 6466ae9
rsz: clang-format RepairSetup.cc
oharboe 5e16c53
rsz: switch WNS-stagnation gate to initial-baseline comparison
oharboe 06caabc
rsz: add repair_setup_hopeless unit test for WNS-stagnation gate
oharboe 2d61012
Merge remote-tracking branch 'origin/master' into end-hopeless-repair
oharboe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| [INFO ODB-0227] LEF file: Nangate45/Nangate45.lef, created 22 layers, 27 vias, 135 library cells | ||
| [INFO RSZ-0100] Repair move sequence: SizeUpMove | ||
| [INFO RSZ-0094] Found 1200 endpoints with setup violations. | ||
| [INFO RSZ-0099] Repairing 1200 out of 1200 (100.00%) violating endpoints... | ||
| Iter | Removed | Resized | Inserted | Cloned | Pin | Area | WNS | StTNS | EnTNS | Viol | Worst | ||
| | Buffers | Gates | Buffers | Gates | Swaps | | | | | Endpts | St/EnPt | ||
| ------------------------------------------------------------------------------------------------------------------------------ | ||
| 0* | 0 | 0 | 0 | 0 | 0 | +0.0% | -0.142 | -170.6 | -170.6 | 1200 | dst0/D | ||
| 1* | 0 | 0 | 0 | 0 | 0 | +0.0% | -0.142 | -170.6 | -170.6 | 1200 | dst0/D | ||
| [INFO RSZ-0234] repair_timing: obviously futile - WNS only reached -0.142 after 1002 passes (initial -0.142, improvement 0.000). This is probably an exploration run, not a timing closure run. Aborting with best-effort result. | ||
| 1002* | 0 | 0 | 0 | 0 | 0 | +0.0% | -0.142 | -170.6 | -170.6 | 1200 | dst0/D | ||
| [INFO RSZ-0236] repair_timing: obviously futile - WNS only reached -0.142 after 1004 passes (initial -0.142, improvement 0.000). This is probably an exploration run, not a timing closure run. Aborting with best-effort result. | ||
| final | 0 | 0 | 0 | 0 | 0 | +0.0% | -0.142 | -170.6 | -170.6 | 1200 | dst0/D | ||
| ------------------------------------------------------------------------------------------------------------------------------ | ||
| [WARNING RSZ-0062] Unable to repair all setup violations. | ||
| worst slack max -0.14 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # repair_timing on a hopelessly under-clocked design must terminate | ||
| # without grinding through the entire endpoint list one futile pass at a | ||
| # time. The block below has many independent register-to-register pairs, | ||
| # a clock period below clk-to-Q + setup, and dont_use + skip_* tuned so | ||
| # no move can improve WNS. Without the WNS-stagnation gate, repair_timing | ||
| # walks the whole 1200-endpoint list; with the gate it exits shortly | ||
| # after the warmup. The .ok pins the bounded behaviour. | ||
|
|
||
| source "helpers.tcl" | ||
| read_liberty Nangate45/Nangate45_typ.lib | ||
| read_lef Nangate45/Nangate45.lef | ||
|
|
||
| set db [ord::get_db] | ||
| set tech [$db getTech] | ||
| set chip [odb::dbChip_create $db $tech] | ||
| set block [odb::dbBlock_create $chip top] | ||
| $block setDefUnits 2000 | ||
| set m1 [$tech findLayer metal1] | ||
| set dff [$db findMaster DFF_X2] | ||
| set dff_d [$dff findMTerm D] | ||
| set dff_q [$dff findMTerm Q] | ||
| set dff_ck [$dff findMTerm CK] | ||
|
|
||
| set clk_net [odb::dbNet_create $block clk] | ||
| set clk_bt [odb::dbBTerm_create $clk_net clk] | ||
| $clk_bt setIoType INPUT | ||
| set bp [odb::dbBPin_create $clk_bt] | ||
| odb::dbBox_create $bp $m1 0 0 100 100 | ||
| $bp setPlacementStatus LOCKED | ||
|
|
||
| set num_pairs 1200 | ||
| for { set i 0 } { $i < $num_pairs } { incr i } { | ||
| set y [expr { $i * 2000 }] | ||
| set src [odb::dbInst_create $block $dff "src$i"] | ||
| $src setLocation 0 $y | ||
| $src setPlacementStatus LOCKED | ||
| [$src getITerm $dff_ck] connect $clk_net | ||
| set dst [odb::dbInst_create $block $dff "dst$i"] | ||
| $dst setLocation 2000 $y | ||
| $dst setPlacementStatus LOCKED | ||
| [$dst getITerm $dff_ck] connect $clk_net | ||
| set n [odb::dbNet_create $block "n$i"] | ||
| [$src getITerm $dff_q] connect $n | ||
| [$dst getITerm $dff_d] connect $n | ||
| } | ||
| ord::design_created | ||
|
|
||
| create_clock -period 0.001 clk | ||
| source Nangate45/Nangate45.rc | ||
| set_wire_rc -layer metal3 | ||
| estimate_parasitics -placement | ||
|
|
||
| # DFF_X2 is the largest DFF in Nangate45; with everything but _X1/_X2 | ||
| # off-limits, SizeUpMove has nothing to size up. | ||
| foreach lib_cell [get_lib_cells *] { | ||
| if { ![regexp {_X[12]$} [get_name $lib_cell]] } { | ||
| set_dont_use $lib_cell | ||
| } | ||
| } | ||
|
|
||
| repair_timing -setup -skip_buffer_removal -skip_pin_swap -skip_gate_cloning \ | ||
| -skip_buffering | ||
| report_worst_slack -max |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| load("@bazel-orfs//:sweep.bzl", "orfs_sweep") | ||
| load("@rules_shell//shell:sh_test.bzl", "sh_test") | ||
| load("//test/orfs:check_same.bzl", "check_same") | ||
|
|
||
| package(features = ["layering_check"]) | ||
|
|
||
| orfs_sweep( | ||
| name = "hopeless", | ||
| # buildifier: disable=unsorted-dict-items | ||
| arguments = { | ||
| "CORE_AREA": "2.16 2.16 45.36 45.36", | ||
| "DIE_AREA": "0 0 47.52 47.52", | ||
| "PLACE_DENSITY": "0.50", | ||
| # Clock period far below what the 8-lane × 8-deep add/xor chain can | ||
| # ever meet. This is the whole point of the test: the flow must bail | ||
| # on an obviously-infeasible target without grinding forever. | ||
| "ABC_CLOCK_PERIOD_IN_PS": "50.0", | ||
| }, | ||
| sources = { | ||
| "RULES_JSON": [":rules-base.json"], | ||
| "SDC_FILE": [":constraint.sdc"], | ||
| }, | ||
| stage = "final", | ||
| sweep = { | ||
| "b": {}, | ||
| "base": {}, | ||
| }, | ||
| tags = ["manual"], | ||
| test_kwargs = { | ||
| "tags": ["orfs"], | ||
| }, | ||
| verilog_files = ["hopeless.v"], | ||
| ) | ||
|
|
||
| check_same( | ||
| name = "hopeless_idempotent_test", | ||
| flow = "hopeless", | ||
| tags = ["orfs"], | ||
| variant_a = "base", | ||
| variant_b = "b", | ||
| ) | ||
|
|
||
| # Asserts the WNS-stagnation gate actually fired on this infeasible design. | ||
| # Without this, the flow could "pass" simply because some other termination | ||
| # mechanism stopped repair_timing, and the real gate would quietly bit-rot. | ||
| sh_test( | ||
| name = "hopeless_stagnation_test", | ||
| srcs = ["check_stagnation.sh"], | ||
| args = ["$(locations :hopeless_base_logs)"], | ||
| data = [":hopeless_base_logs"], | ||
| tags = ["orfs"], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # hopeless | ||
|
|
||
| Regression test for the WNS-stagnation gate in `repair_timing` | ||
| (`src/rsz/src/RepairSetup.cc`). | ||
|
|
||
| The design is a deliberately deep combinational chain clocked impossibly fast | ||
| (see `constraint.sdc` + `ABC_CLOCK_PERIOD_IN_PS` in `BUILD`). With the old | ||
| defaults, `repair_timing` would grind forever producing tiny TNS twitches | ||
| without moving WNS. With the gate, the phase aborts deterministically after | ||
| ~1200 iterations of no WNS movement and logs `repair_timing: WNS stuck at ...`. | ||
|
|
||
| The test asserts only that the flow completes within the bazel timeout. | ||
| QoR is intentionally unchecked — the point is bounded runtime and determinism. | ||
|
|
||
| Run: | ||
|
|
||
| ``` | ||
| bazelisk test //test/orfs/hopeless:hopeless_final_base_test | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logger_->info(...)call in every caller site.It would be better to move the
logger_->info(...)call withinwnsStagnationReport().Then
wnsStagnationReport()does not require the argument and string return.