Repository navigation
Conversation
There was a problem hiding this comment.
Code Review
This pull request modifies the synthesis script flow/scripts/synth.tcl to avoid throwing an error when a module specified in SYNTH_KEEP_MODULES is not found, as long as SYNTH_BLACKBOXES is defined. The feedback highlights that if the module is missing, the script still attempts to run setattr on an empty selection, which could lead to unintended behavior in Yosys. It is recommended to guard the setattr command so that it only runs when the module is actually found.
A partition of a parallel synthesis (SYNTH_BLACKBOXES set, one run per partition driven by an external orchestrator) loads only its own portion of the design; the kept modules of the other partitions are not in it. The check added in The-OpenROAD-Project#4745, that every SYNTH_KEEP_MODULES name selects a module, therefore stops such a partition with "SYNTH_KEEP_MODULES: no module <name> in the design". The check now runs only when the whole design is synthesised, where a name that matches nothing is a typo; in a partition a missing name is expected, as it already is for SYNTH_BLACKBOXES. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
7fb9cb3 to
48126f2
Compare
🔍 QoR checkMetrics reflect the PR merge build — i.e. what will land on the target branch. Commit 62 design(s) checked — 0 with regression(s), 0 without a comparable baseline. |
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
maliberty
left a comment
There was a problem hiding this comment.
The bug is real: each bazel-orfs partition loads its own per-module RTLIL slice, so a check against the whole design can't pass there. My main concern is the flag used to detect a partition (see the inline comment).
Two more points:
variables.yaml:SYNTH_KEEP_MODULESstill says "A name that matches no module of the design stops synthesis." It should say this applies only when the whole design is synthesized, not in a partition.- Question: partition mode always runs
synth -flatten. In a partition, the other kept modules are already blackboxes and the partition's own top is never flattened, sosetattr keep_hierarchymay do nothing there. If so, bazel-orfs could simply not passSYNTH_KEEP_MODULESto partitions, andsynth.tclwould need no change. Is there a case where the attribute matters in a partition?
| # partition is not loaded: the selection is empty and setattr below | ||
| # marks nothing. | ||
| if { | ||
| ![env_var_exists_and_non_empty SYNTH_BLACKBOXES] |
There was a problem hiding this comment.
SYNTH_BLACKBOXES isn't a partition-only flag. variables.yaml documents it as a general option ("List of cells treated as a black box by Yosys"), and asap7/aes (FLOW_VARIANT=top) and asap7/uart set it in ordinary single-design make runs. In those runs this condition turns the typo check off without any warning, which is what TclContract.md rules out ("A script never trades an explicit variable for a clever one").
SYNTH_CHECKPOINT is the variable that actually means "partition". variables.yaml says it is for parallel synthesis and should be left unset in the normal flow, synth.tcl already uses it further down to pick the "Partition mode" branches, and all three partition calls in bazel-orfs synth_partition.sh set it:
| ![env_var_exists_and_non_empty SYNTH_BLACKBOXES] | |
| ![env_var_exists_and_non_empty SYNTH_CHECKPOINT] |
(bazel-orfs patch 0168 would need the same change.)
There was a problem hiding this comment.
Done in f24a00e: gated on SYNTH_CHECKPOINT. bazel-orfs 0168 already had this gate; with the SYNTH_BLACKBOXES gate a grouped pinned partition (no SYNTH_BLACKBOXES) still stopped, see the test in The-OpenROAD-Project/bazel-orfs#1534.
| # In a partition (SYNTH_BLACKBOXES set) a kept module of another | ||
| # partition is not loaded: the selection is empty and setattr below | ||
| # marks nothing. |
There was a problem hiding this comment.
With the gate changed, this comment should say SYNTH_CHECKPOINT instead. Also, the other partitions' kept modules may be missing from the per-module slice entirely, not only unloaded, so maybe "is not in this partition's checkpoint".
There was a problem hiding this comment.
Done in f24a00e: "In a partition (SYNTH_CHECKPOINT set) a kept module of another partition is not in this partition's checkpoint".
SYNTH_BLACKBOXES is a general option: asap7/aes (FLOW_VARIANT=top) and asap7/uart set it in single-design runs, and keying the SYNTH_KEEP_MODULES name check on it turned the check off there without a word. It also missed a partition synthesised from a per-module slice without SYNTH_BLACKBOXES: a kept module that is an ancestor of another is not in the child's slice at all, so the check still stopped it. SYNTH_CHECKPOINT is what synth.tcl already reads as "partition mode" further down, and every partition of a parallel synthesis sets it. The check now runs whenever it is unset. variables.yaml says where the check applies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
|
On the question: the attribute matters in a partition. bazel-orfs fixtures, partitions run with and without
The top partition does not blackbox every kept module, and |
Since #4745, a partition of a parallel synthesis stops at its first kept module that sits in another partition:
A partition run (
SYNTH_CHECKPOINTset, one run per partition, driven by an external orchestrator) reads a checkpoint that holds only its own portion of the design. The kept modules of the other partitions are not in it: blackboxed, or, for a kept module that is an ancestor of another, absent from the child's slice. So the check from #4745 has to skip them there.synth: no SYNTH_KEEP_MODULES name check in a partition: the check runs only when the whole design is synthesised. In that case a name that selects no module is still a typo and still stops synthesis.synth: a partition is told by SYNTH_CHECKPOINT, not SYNTH_BLACKBOXES:SYNTH_BLACKBOXESis also set in single-design runs (asap7/aestop,asap7/uart), where the check must run; and a partition synthesised from its own slice does not set it.variables.yamlsays where the check applies.Tested in bazel-orfs, whose parallel synthesis is such an orchestrator: The-OpenROAD-Project/bazel-orfs#1534 carries this change and adds a seconds-long test of nested kept modules in one partition, which stops with
no module nested_innerwithout the change and with theSYNTH_BLACKBOXESgate.tclfmtandtclint0.7.0 are clean;variables.jsonandFlowVariables.mdregenerated.