You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7daba05
Browse filesBrowse the repository at this point in the historyBrowse files
flow: drill down — non-determinism enters in read_design_sources
The earlier three-way hash (`canonical`, `preabc`, `netlist`) showed
all three differing between bazel-yosys and make-yosys even at
matching versions (Yosys 0.65, ABC 1.01), but couldn't pinpoint
which yosys pass introduces the drift. This commit adds three
more hash points to bisect:
post_read_sources : after `read_design_sources` (verilog/slang frontend only)
post_hierarchy : after `hierarchy -check -top` (elaboration order)
canonical_netlist : after `opt_clean -purge` (existing)
post_synth_main : after `synth -run fine: -noabc` (main synth pipeline)
preabc_netlist : immediately before `abc` (existing)
netlist : post-ABC `1_2_yosys.v` (existing)
Mechanism: `synth_preamble.tcl` defines a `write_state_hash` tcl
proc that `setattr -unset src */mod` (so paths in src attributes
don't make the hash bazel-vs-make path-dependent), `write_rtlil`
to a temp, sha1sum, deletes the temp, and `puts` a
`<metric>: <sha>` line to the yosys log. `genMetrics.py` greps
the lines via `extractTagFromFile`. No new bazel artifacts ship;
the existing `1_1_yosys_canonicalize.log` / `1_2_yosys.log` carry
the SHAs.
The `setattr -unset src` strip is now unconditional (the
`SYNTH_REPEATABLE_BUILD`-gated block in `synth_canonicalize.tcl`
becomes redundant since `write_state_hash` strips on first call;
left in place as harmless idempotent backup). Src attributes are
debug metadata that no downstream pass relies on for decisions.
Verification on asap7/uart with same-version yosys/ABC on both
sides:
[INFO] synth__yosys__version pass test: 0.65 == 0.65
[INFO] synth__abc__version pass test: 1.01 == 1.01
[WARN] synth__post_read_sources__hash differs test: 39c975e8... == fc8ed9cc...
[WARN] synth__post_hierarchy__hash differs test: 39c975e8... == fc8ed9cc...
[WARN] synth__canonical_netlist__hash differs test: c1269aa7... == 579a132d...
[WARN] synth__post_synth_main__hash differs test: 0cb19660... == 022a854d...
[WARN] synth__preabc_netlist__hash differs test: 49c7bd07... == 6a40bd28...
[WARN] synth__netlist__hash differs test: 5ed342e4... == c3163e94...
Two findings fall out:
1. Non-determinism is born at `post_read_sources`. `hierarchy
-check` is a no-op for uart (slang has already elaborated the
top); `post_hierarchy` matches `post_read_sources` exactly on
both sides. Every subsequent pass (opt_clean, synth pipeline,
techmap+dfflibmap, ABC) faithfully propagates the entering
divergence but does not introduce new divergence between bazel
and make.
2. The slang frontend call is therefore the proximate site of the
drift. Mechanism is consistent with yosys' pointer-keyed
`IdString`/`dict` iteration: different memory layouts in the
bazel-built and make-built yosys binaries assign different
counter values to anonymous wires (visible as systematic `+3`
offsets in `$<N>y` wire names in the canonical RTLIL diff).
Next investigation: which yosys API call in `read_slang`'s
implementation allocates IdStrings/dicts/pools in pointer order?
That's the patch site.
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
0 commit comments