Skip to content

rsz: stage delay implementation for the Legacy policy#10803

Draft
jfgava wants to merge 5 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:rsz-stage-delay
Draft

rsz: stage delay implementation for the Legacy policy#10803
jfgava wants to merge 5 commits into
The-OpenROAD-Project:masterfrom
The-OpenROAD-Project-staging:rsz-stage-delay

Conversation

@jfgava

@jfgava jfgava commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Stage_delay = load_delay + wire_delay

OptimizerTypes.hh — added bool use_stage_delay_ranking{false} to OptimizerRunConfig.

SetupLegacyBase.cc — rankPathDrivers() now optionally looks one step ahead in the expanded path to fetch the wire edge after each driver, computes wire_delay = arcDelay(net_edge, ...), and uses load_delay + wire_delay as the ranking key. When the flag is off, wire_delay is 0.0, so the behavior is identical to before.

Resizer.hh — added bool use_stage_delay_ranking = false (with default) to repairSetup().

Resizer.cc — accepts the new param and assigns config.use_stage_delay_ranking.

Resizer.i / Resizer-py.i — forwarded the new bool through the SWIG Tcl and Python bindings.

Resizer.tcl — added -use_stage_delay flag to define_cmd_args, parse_key_args, and the rsz::repair_setup call.

Usage: repair_timing -setup -use_stage_delay

Tests for repair_timing -use_stage_delay

C++ Unit Tests — Tier 1
File: src/rsz/test/cpp/TestSetupLegacyBase.cc

Design under test: src/rsz/test/cpp/TestSetupLegacyBase_StageDelay.v — a minimal 2-stage combinational chain (Nangate45, 2 DFF registers with a 2-inverter path in between).

Fixture: tst::IntegratedFixture (kNangate45). Placement uses compact coordinates (stage1 at origin, stage2 at 4000 dbu / 2 µm) so HPWL estimation runs without requiring SPEF.

StageDelayEqualsLoadPlusWireDelay
Verifies the core formula introduced in SetupLegacyBase::rankPathDrivers():

stage_delay[i] == load_delay[i] + wire_delay_after_driver[i]
For every driver stage on the worst-slack path to endpoint out, the test independently re-derives wire_delay by walking the STA graph edge following the gate arc and checking Edge::isWire(). Asserts stage_delay >= load_delay (wire delay is non-negative).

BothModesReturnResultsSortedDescending
Verifies the sort invariant that rankPathDrivers() guarantees for both modes: results must be in descending order by delay (primary key), with ties broken by descending path index (secondary key). Passes the same expanded path through both use_stage_delay=false and use_stage_delay=true and checks the ordering independently for each.

Tcl Integration Test — Tier 2 (PASSFAIL)
File: src/rsz/test/repair_setup_stage_delay.tcl
Golden file: src/rsz/test/repair_setup_stage_delay.ok

Smoke test that repair_timing -setup -use_stage_delay is accepted as a valid flag, the command completes without error, and produces the expected repair output.

Type of Change

  • New feature

Impact

Instead of focusing just on the load_delays, now we also consider wire_delays when ranking the drivers to optimize first.

Verification

  • I have verified that the local build succeeds (./etc/Build.sh).
  • I have run the relevant tests and they pass.
  • My code follows the repository's formatting guidelines.
  • I have included tests to prevent regressions.
  • I have signed my commits (DCO).

jfgava added 5 commits July 2, 2026 01:23
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
Signed-off-by: Jonas Gava <jfgava@precisioninno.com>
@jfgava jfgava self-assigned this Jul 3, 2026
@github-actions github-actions Bot added the size/M label Jul 3, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@jfgava

jfgava commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

To use Codex here, create a Codex account and connect to github.

@maliberty

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: da7aaba3bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants