Skip to content

Conversation

@rocallahan
Copy link
Contributor

@rocallahan rocallahan commented Dec 3, 2025

If your work is part of a larger effort, please discuss your general plans on Discourse first to align your vision with maintainers.

https://yosyshq.discourse.group/t/parallel-optmergepass-implementation/

What are the reasons/motivation for this change?

Massive speedups on large modules. On a particular real-world flattened design with millions of cells, at 20 cores I get 14.5x speedup on an opt_merge that takes 15 iterations internally. On a 48-core machine speedup levels out at 25x.

Another way to get massive speedups would be to make opt_merge incremental, i.e. at each step only consider merging cells whose state or connected cells have changed since the last iteration of opt_merge. That would be more efficient, but also more invasive since information about what's changed would have to be kept up to date across passes. Anyway, see the discussion in the Discourse thread.

Explain how this is achieved.

This is the same algorithm presented in the Discourse thread, but over the last few months we've upgraded RTLIL to be thread-safe for read-only access, so there is no extra TRTLIL layer anymore and a lot less code needs to change here.

I'm not sure why but this is actually faster than existing opt_merge even with YOSYS_MAX_THREADS=1, for the jpeg synthesis test. 16.0s before, 15.5s after for end-to-end synthesis.

I'm not sure why but this is actually faster than existing `opt_merge` even with
YOSYS_MAX_THREADS=1, for the jpeg synthesis test. 16.0s before, 15.5s after for
end-to-end synthesis.
@widlarizer widlarizer self-assigned this Dec 3, 2025
@widlarizer widlarizer self-requested a review December 3, 2025 13:48
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