Skip to content

synth: single writer for 1_synth.sdc, fail hard on missing outputs#754

Merged
oharboe merged 1 commit into
mainfrom
orfs-single-writer-1synth-sdc
Jul 6, 2026
Merged

synth: single writer for 1_synth.sdc, fail hard on missing outputs#754
oharboe merged 1 commit into
mainfrom
orfs-single-writer-1synth-sdc

Conversation

@oharboe

@oharboe oharboe commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Root-cause fix for the read-only 1_synth.sdc failure hzeller hit on RBE (OpenROAD PR #10818 worked around it with chmod +w).

The bug

1_synth.sdc had two writers in ORFS:

  1. yosys' synth.tcl copied the user's SDC_FILE into place — a leftover from before SDC canonicalization existed ("One day a more sophisticated synthesis will write out a modified .sdc").
  2. synth_odb.tcl then overwrote it in place with the OpenSTA-canonicalized version (write_sdc -no_timestamp).

cp preserves mode bits, so with read-only inputs (bazel RBE) the copy is read-only and the canonicalization write fails. On writable local checkouts it only accidentally worked.

The fix

patches/0037 (carried until the identical fix lands in ORFS upstream, then dropped at the next bump):

  • synth.tcl / synth_preamble.tcl no longer produce 1_synth.sdc; the yosys stage's SDC output is 1_2_yosys.sdc (raw copy), as before.
  • synth_odb.tcl / synth_syn.tcl are the sole writers of 1_synth.sdc, and write 1_synth.odb/.sdc unconditionally: producing them is the do-1_synth contract. The WRITE_ODB_AND_SDC_EACH_STAGE=0 no-op silently left downstream stages consuming the stale raw copy.

rules.bzl (fail hard and early instead of festering):

  • 1_synth.sdc is declared together with 1_synth.odb only when save_odb=True, instead of as a yosys output. (save_odb=False users only consume the 1_2_yosys.v output group.)
  • Stop touch-masking primary artifacts (1_2_yosys.v/.sdc, 1_synth.odb/.sdc) after make: a synth step that silently produced nothing used to yield empty files that flowed downstream — and would let idempotency tests compare two empty files as "identical". Now bazel fails the action with "declared output was not created". Logs, reports and mem.json remain touch-stubbed since the SYNTH_NETLIST_FILES path legitimately skips them.

Testing

  • bazelisk test //test/...: 43 pass; 17 fail to build locally due to the pre-existing @scip glibc 2.41 compile issue (unrelated — real-OpenROAD targets; covered by CI).
  • Verified the patch applies to the pinned ORFS and that the patched @orfs scripts contain a single 1_synth.sdc writer.

Follow-ups after merge: bazelisk run @bazel-orfs//:bump in OpenROAD (unblocks the RBE tests, replaces #10818), and the same fix as an ORFS PR so patch 0037 can be dropped.

🤖 Generated with Claude Code

1_synth.sdc had two writers in ORFS: yosys' synth.tcl copied the
user's SDC_FILE into place (a pre-canonicalization leftover), then
synth_odb.tcl overwrote it in place with the OpenSTA-canonicalized
version. cp preserves mode bits, so with read-only inputs (bazel RBE)
the copy is read-only and the canonicalization write fails; on
writable local checkouts it only accidentally worked (see OpenROAD
PR #10818, which papered over this with chmod +w).

Carry the ORFS fix as patches/0037 until it lands upstream:
synth.tcl/synth_preamble.tcl no longer produce 1_synth.sdc;
synth_odb.tcl/synth_syn.tcl are its sole writers and write
1_synth.odb/.sdc unconditionally, since producing them is the
do-1_synth contract (the WRITE_ODB_AND_SDC_EACH_STAGE=0 no-op
silently left downstream stages consuming the stale raw copy).
The vendored //:synth.tcl test fixture is updated to match.

On the rules side, declare 1_synth.sdc with 1_synth.odb only when
save_odb=True instead of as a yosys output, and stop touch-masking
primary artifacts (1_2_yosys.v/.sdc, 1_synth.odb/.sdc) after make:
a synth step that silently produces nothing used to yield empty
files that flowed downstream (and let idempotency tests compare two
empty files as "identical"); now bazel fails the action early with
"declared output was not created". Logs, reports and mem.json remain
touch-stubbed since the SYNTH_NETLIST_FILES path legitimately skips
them.

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

oharboe commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator Author

@hzeller FYI

@oharboe oharboe merged commit 90ad965 into main Jul 6, 2026
1 check passed
@oharboe oharboe deleted the orfs-single-writer-1synth-sdc branch July 6, 2026 10:34
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.

1 participant