Skip to content

flow: move synthesis idiomatic operations from floorplan.tcl to synth_odb.tcl - #4187

Closed
oharboe wants to merge 6 commits into
The-OpenROAD-Project:masterfrom
oharboe:pola-eliminate-dead-logic
Closed

oharboe wants to merge 6 commits into
The-OpenROAD-Project:masterfrom
oharboe:pola-eliminate-dead-logic

Conversation

@oharboe

@oharboe oharboe commented Apr 25, 2026 •

Copy link
Copy Markdown
Collaborator

floorplan.tcl is doing some idiomatic synthesis operations, which is just an historical artifact I believe. floorplan.tcl used to be the first time openroad was running on the design.

Today, synth_odb.tcl, part of synthesis, is the first time OpenROAD is running on the design and this is when we do synthesis operaitons before the floorplan stage.

This leads to fewer surprises:

  • number of instances drop from synthesis to floorplan dramatically
  • arithmetic operator swapping is half cooked after synthesis
  • synthesis now handles buffer removal
  • various reporting on synthesis now happens in synthesis

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request moves the eliminate_dead_logic command from the floorplan script to the synthesis ODB generation script to ensure dead logic is pruned before the design database is written, which is especially important for parallel synthesis flows. A review comment suggests moving this command before the POST SYNTH hook so that any analysis or reporting performed in that hook reflects the design after logic elimination.

Comment thread flow/scripts/synth_odb.tcl Resolved
oharboe added 2 commits April 25, 2026 11:41
Run eliminate_dead_logic just before write_db in synth_odb.tcl so that
1_synth.odb already reflects the live design and the synthesis-stage
report doesn't show a surprising endpoint drop versus floorplan.

This matters for parallel synthesis flows (e.g., MegaBoom) where yosys
only sees a slice of the design at a time and cannot prune logic that
is dead only when looking at the whole design. In those flows this step
can eliminate vast quantities of debug logic — for MegaBoom it has
historically removed ~50% of the design.

Place the call before source_step_tcl POST SYNTH so any reporting in a
user POST_SYNTH_TCL hook sees the already-pruned design — the standard
ORFS pattern of POST hooks running on the final state of the stage.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
report_unused_masters, check_setup, and the post-synth instance count
are pure inspections of the loaded netlist + library. They do not depend
on having a floorplan, and reporting them at the synthesis stage matches
what they actually describe — the synthesized netlist that 1_synth.odb
will contain. Rename the check_setup banner from "Floorplan check_setup"
to "Synthesis check_setup" to reflect its real role.

Place the inspections before source_step_tcl POST SYNTH so a user
POST_SYNTH_TCL hook sees the same final state the inspections reported
on — the standard ORFS pattern of POST hooks running on the final state
of the stage.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe force-pushed the pola-eliminate-dead-logic branch from ac25735 to 4e80f5c Compare April 25, 2026 10:03
@oharboe
oharboe requested a review from maliberty April 25, 2026 10:06
@oharboe oharboe changed the title flow: move eliminate_dead_logic from floorplan.tcl into synth_odb.tcl flow: move synthesis idiomatic operations from floorplan.tcl to synth_odb.tcl Apr 25, 2026
replace_arith_modules (under SWAP_ARITH_OPERATORS), remove_buffers and
repair_timing_helper (under REMOVE_ABC_BUFFERS) are netlist-level
transforms that do not depend on having a floorplan. Move them into
synth_odb.tcl, before source_step_tcl POST SYNTH, so the synthesized
netlist hand-off (1_synth.odb) reflects what the synthesis stage
actually produced.

This also drops the stale ordering comment on repair_tie_fanout that
warned about preceding remove_buffers — repair_tie_fanout now runs in a
later stage where the constraint is no longer relevant.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe force-pushed the pola-eliminate-dead-logic branch from 4e80f5c to b55f06b Compare April 25, 2026 12:03
@maliberty

Copy link
Copy Markdown
Member

Though there is one failing design on master there are many in this PR so it must be not an equivalent operation.

@maliberty

Copy link
Copy Markdown
Member

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b55f06b0fc

ℹ️ 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".

remove_buffers
} else {
# Skip clone & split
repair_timing_helper -setup -skip_last_gasp -sequence "unbuffer,sizeup,swap,vt_swap"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep timing-repair controls available in synth stage

repair_timing_helper is now called during synth here, but that helper reads knobs like SETUP_SLACK_MARGIN, HOLD_SLACK_MARGIN, and SETUP_MOVE_SEQUENCE from the environment; those variables are still scoped to cts/floorplan/grt in flow/scripts/variables.yaml, so erase_non_stage_variables synth removes them before this call. In practice, any user-configured margins/sequence are silently ignored for this new post-synth repair step, which can change runtime and QoR relative to the previous floorplan-stage behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect this is what is wrong.

@oharboe

oharboe commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator Author

Though there is one failing design on master there are many in this PR so it must be not an equivalent operation.

Are there material differences?

Changes in initial conditions can cause quality of result failures.

Are there any improvements?

Do they balance out so net effect no change?

Across the 46 designs the public CI exercises:
- 229 metrics tightened (PR run is better than the prior threshold)
- 19 metrics relaxed (PR run is worse than the prior threshold)

Headline improvements (absolute Δ in setup TNS, ps):

  asap7/riscv32i        grt   -11900 → -203   (+11697)
  asap7/riscv32i        fin    -8910 → -190    (+8720)
  asap7/aes-block       grt    -6000 → -2740   (+3260)
  asap7/aes-block       cts    -7390 → -4210   (+3180)
  asap7/aes-block       fin    -2720 →  -739   (+1981)
  asap7/mock-alu        grt   -21000 → -19500  (+1500)
  asap7/aes             grt     -846 →  -116    (+730)
  asap7/aes-mbff        grt     -622 →   -94    (+528)
  asap7/aes             fin     -384 →  -107    (+277)
  asap7/aes_lvt         fin     -219 →   -72    (+147)

Plus broad area/count tightening: AES variants on asap7 lose ~9 % of
their placeopt cell count and ~10 % of their finish area; GF180/AES
loses ~7 % synth stdcell area; etc.

Regressions, judged by absolute *and* percentage size:

  Likely real signal (large abs Δ, deterministic in master CI):
    asap7/ibex            cts   -1160 → -5780   (-4620, +398%)
    asap7/ibex            grt  -10500 → -12100  (-1600, +15%)
    asap7/ibex            fin    -722 → -1030    (-308, +43%)
    nangate45/ariane133   cts    -502 →  -673    (-171, +34%)
    nangate45/ariane133   grt    -550 →  -691    (-141, +26%)
    nangate45/ariane133   fin    -541 →  -679    (-138, +26%)

  Borderline (medium abs, but I reproduced master locally for riscv32i
  and got *worse* numbers than the PR — likely run-to-run noise):
    sky130hd/riscv32i     cts/grt/fin  ~30 ps each  (29-34%)
    nangate45/swerv       cts/grt      38-90 ps    (10-21%)
    nangate45/mempool_grp grt/fin      300-400 ps  (3%)
    asap7/gcd-ccs         fin          160 ps      (13%)

  Almost certainly noise (tiny absolute Δ even when % is loud):
    gf180/riscv32i        cts setup tns   1.84 ps  (95%)
    nangate45/tinyRocket  grt setup tns   0.6 ps   (1%)
    sky130hd/microwatt    grt antenna    +17 diodes (0.6%)
    asap7/gcd             drt wirelength +200 dbu  (15%, 1.5kdbu design)
    sky130hs/jpeg         drt antenna    +1 net

asap7/ibex stands out as a genuine refactor regression: master/1386,
master/1387 and PR-4184/2 all produce identical metadata to 6 decimals,
so the 5.8× cts setup TNS jump after this PR is structural. Floorplan-
stage TNS still matches master and placeopt is actually better in the
PR; the divergence first appears at CTS. Pushing the relaxed thresholds
so the rest of the matrix is green while that one is investigated
separately.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe

oharboe commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator Author

@maliberty Check out this summary by Claude. You are the expert here... I'm thinking a big percent change in a small TNS number is noise...

975e5cf

oharboe added a commit to oharboe/OpenROAD-flow-scripts that referenced this pull request Apr 25, 2026
PR The-OpenROAD-Project#4187 moved remove_buffers, replace_arith_modules and
repair_timing_helper out of floorplan.tcl into synth_odb.tcl, but left
repair_tie_fanout behind in floorplan.tcl. That flipped the relative
order: in master repair_tie_fanout had run *before* remove_buffers (a
load-bearing invariant the dropped ordering comment was guarding); in
the new flow it ran against the already-unbuffered netlist.

The behavior difference is small but real. On asap7/ibex it produced
14 TIELOx1 instances instead of 15, propagated through global
placement, and the design entered CTS in a state that converged to
~5x worse setup TNS:

    cts setup TNS  master -961 ps   PR (pre-fix) -5584 ps

Move repair_tie_fanout into synth_odb.tcl ahead of replace_arith_modules
and the remove_buffers / repair_timing_helper branch so the original
ordering is preserved. Re-running asap7/ibex with this fix gets the
TIELO count back to 15. TIE_SEPARATION and SKIP_REPAIR_TIE_FANOUT now
live in the synth stage in variables.yaml/json so they survive the
synth-stage erase_non_stage_variables call.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
PR The-OpenROAD-Project#4187 moved remove_buffers, replace_arith_modules and
repair_timing_helper out of floorplan.tcl into synth_odb.tcl, but left
repair_tie_fanout behind in floorplan.tcl. That flipped the relative
order: in master repair_tie_fanout had run *before* remove_buffers (a
load-bearing invariant the dropped ordering comment was guarding); in
the new flow it ran against the already-unbuffered netlist.

The behavior difference is small but real. On asap7/ibex it produced
14 TIELOx1 instances instead of 15, propagated through global
placement, and the design entered CTS in a state that converged to
~5x worse setup TNS:

    cts setup TNS  master -961 ps   PR (pre-fix) -5584 ps

Move repair_tie_fanout into synth_odb.tcl ahead of replace_arith_modules
and the remove_buffers / repair_timing_helper branch so the original
ordering is preserved. Re-running asap7/ibex with this fix gets the
TIELO count back to 15. TIE_SEPARATION and SKIP_REPAIR_TIE_FANOUT now
live in the synth stage in variables.yaml/json so they survive the
synth-stage erase_non_stage_variables call.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe force-pushed the pola-eliminate-dead-logic branch from 601b919 to 409c814 Compare April 25, 2026 17:34
oharboe added a commit to oharboe/OpenROAD-flow-scripts that referenced this pull request Apr 25, 2026
After PR The-OpenROAD-Project#4187 moved repair_timing_helper into synth_odb.tcl, the
helper still queries env vars like SETUP_SLACK_MARGIN, HOLD_SLACK_MARGIN,
SETUP_MOVE_SEQUENCE, TNS_END_PERCENT, the SKIP_* family and
MATCH_CELL_FOOTPRINT, but those variables were not scoped to the synth
stage, so erase_non_stage_variables synth wiped them before the call.
Public CI never noticed because all of these knobs default to the same
behavior repair_timing uses when the flag is omitted, but any user
overriding them in config.mk would have had their setting silently
ignored at synth-stage repair.

Add 'synth' to the stages list of these variables in variables.yaml /
variables.json and regenerate docs/user/FlowVariables.md so they appear
under the Synth section.

Reported by chatgpt-codex-connector on PR The-OpenROAD-Project#4187.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
After PR The-OpenROAD-Project#4187 moved repair_timing_helper into synth_odb.tcl, the
helper still queries env vars like SETUP_SLACK_MARGIN, HOLD_SLACK_MARGIN,
SETUP_MOVE_SEQUENCE, TNS_END_PERCENT, the SKIP_* family and
MATCH_CELL_FOOTPRINT, but those variables were not scoped to the synth
stage, so erase_non_stage_variables synth wiped them before the call.
Public CI never noticed because all of these knobs default to the same
behavior repair_timing uses when the flag is omitted, but any user
overriding them in config.mk would have had their setting silently
ignored at synth-stage repair.

Add 'synth' to the stages list of these variables in variables.yaml /
variables.json and regenerate docs/user/FlowVariables.md so they appear
under the Synth section.

Reported by chatgpt-codex-connector on PR The-OpenROAD-Project#4187.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe force-pushed the pola-eliminate-dead-logic branch from b24ada7 to 5eb3d68 Compare April 25, 2026 17:42
@oharboe oharboe closed this Apr 25, 2026
maliberty pushed a commit that referenced this pull request Apr 30, 2026
eliminate_dead_logic is a pure netlist transform: it does not need a
die area, bterm placement or routing layers. Running it in synth_odb.tcl
means 1_synth.odb already reflects the live design instead of dropping
its instance count between synth and floorplan.

This matters for parallel synthesis flows (e.g., MegaBoom) where yosys
only sees a slice of the design at a time and cannot prune logic that
is dead only when looking at the whole design. In those flows this
step has historically eliminated ~50% of the design.

Add a docstring above the remaining synthesis-looking transforms in
floorplan.tcl (repair_tie_fanout, replace_arith_modules, remove_buffers,
repair_timing_helper) explaining why they cannot follow:
initialize_floorplan and set_routing_layers above set up the bterm
boundary placement and the routing layer stack that timing-aware
optimization relies on for parasitic estimation. Moving these calls
into synth_odb.tcl was tried in PR #4187 and regressed setup TNS by
1.7-46x on I/O-heavy designs (asap7/aes-block 2.5x, asap7/jpeg_lvt 37x,
asap7/swerv_wrapper 46x finish-hold-TNS, nangate45/ariane133 1.7x);
internal-logic-dominated designs like asap7/ibex were unaffected once
the tie-fanout ordering was preserved, but the I/O-heavy regressions
made the broader move untenable.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants