ITADN

opt_reduce: $pmux input dedup emits inputs in dict (hash) order instead of source order, causing QoR regression

#5968Closededer-matheus 创建于 2026-06-18
pending-verification
E
eder-matheuscommented
### Version Yosys 0.66 (git sha1 7d3819c6b, g++ 13.3.0-6ubuntu2~24.04.1 -fPIC -O3) [the-openroad-project/yosys] ### On which OS did this happen? Linux ### Reproduction Steps Build Yosys at 4abaca273 and its parent 3ccbd38cc; from the testcase dir run yosys run.ys with each and diff the resulting out.il. [opt_reduce_pmux_testcase.tar.gz](https://github.com/user-attachments/files/29103597/opt_reduce_pmux_testcase.tar.gz) Reproduce with the attached ORFS reproducible (synth_riscv32i_opt_reduce_pmux.tar.gz): ``` tar xzf synth_riscv32i_opt_reduce_pmux.tar.gz cd synth_riscv32i_opt_reduce_pmux ./run-me-riscv32i-asap7-base.sh # runs: yosys -c scripts/synth.tcl ``` This writes results/asap7/riscv32i/base/1_2_yosys.v. Run it once with stock Yosys and once with 4abaca273 reverted. [synth_riscv32i_opt_reduce_pmux.tar.gz](https://github.com/user-attachments/files/29104556/synth_riscv32i_opt_reduce_pmux.tar.gz) After reverting the commit with problem, ORFS results for ASAP7 design with huge degradation are much better: design | metric | 0.64 (good) | 0.66 (bad) | 0.66 + reverts -- | -- | -- | -- | -- riscv32i | cts setup WS | 0.5099 | −44.43 | 0.5099   | cts setup TNS | 0 | −18626.7 | 0   | finish setup WS | −35.21 | −40.82 | −35.21   | finish setup TNS | −6550 | −15490.3 | −6550 ibex | cts setup WS | −44.10 | −52.02 | −44.10   | cts setup TNS | −6955.64 | −17483.6 | −6955.64   | finish setup WS | −5.767 | −12.52 | −5.767   | finish setup TNS | −6.375 | −27.87 | −6.375 ### Expected Behavior New Yosys versions should not cause huge degradations in QoR on OpenROAD-flow-scripts. ### Actual Behavior Yosys commit `4abaca273` refactored `$pmux` input merging in `opt_reduce` to group select bits via a `dict<RTLIL::SigSpec, std::vector<RTLIL::SigBit>>` and emit them in hash-map iteration order instead of the original first-occurrence order. Functionally identical, but it reorders the mux inputs — which cascades into a different AIG for ABC → different (worse-placing) mapping. This resulted in large degradations on OpenROAD-flow-scripts designs, specially asap7 designs. Reverting this commit fixed the large degradations in all asap7 designs.
关闭于 2026-07-15 3 条评论