signorm: directed RTLIL, incremental optimization#5804
Draft
widlarizer wants to merge 79 commits intomainfrom
Draft
signorm: directed RTLIL, incremental optimization#5804widlarizer wants to merge 79 commits intomainfrom
widlarizer wants to merge 79 commits intomainfrom
Conversation
a90d1b5 to
4daed6f
Compare
Collaborator
Author
|
Currently crashes in parallelized |
This was referenced Apr 20, 2026
…t old driven wire
Collaborator
Author
|
opt_merge and opt_expr now have better performance than on main but the repeated construction of the signorm index adds a lot of overhead. This is because opt_dff and opt_clean leave signorm mode. Not sure yet if making opt_clean fully signorm-compatible is possible or a good idea, but at least, parts of it could be improved |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Signorm is an extended redesign of bufnorm (#3967) by @jix. It's a foundational change to the lack of well-defined directionality in general RTLIL. The idea behind signorm is described on an abstract level here. Its potential is hard to overstate since it allows for
at no reduction in the support of tristate and conflicting drivers generally - the caveats that made it difficult in the past for Yosys to have a concept of direction in RTLIL.
What this means for you
The impact on synthesis and formal flow users will be purely performance improvements. The impact on synthesis and formal flow maintainers may be significant, meaning your custom Yosys pass sequencing may break, but we'll be ready to help. The impact on plugins is that they may break in silent ways.
Things that can break
designpass for exampleRTLIL::Monitorhierarchycommand to resolve $connect into appropriately orderedModule::connectionsto support cases where blackboxes/implementations are added after verilog is elaborated etcequiv_optandtechmaphad to be fixed this waydocs/source/yosys_internals/techmap.rstalready, but we had some like that anywayhierarchymode that matches whattechmapneedsAll passes that match the above have to be fixed - if they may ever run after any signorm-entering pass, which is almost always true. Even if signorm is exited, extra wire aliasing may break passes that silently rely on for example a conventional implicit "normalization" by
opt_clean.Passes that have to exit signorm
Some sketchy parts of the RTLIL interface that are incompatible with signorm (and shouldn't be made compatible with it)
swap_names,rename,rewrite_sigspecs$dffeto$dffbefore removing the EN port)Corner cases with special handling
What's next
This working is pending an intense, gradual rebase. Parallel
opt_mergewill probably be added have alongside the new incrementalopt_merge_inc. There's also a couple things fixed in the wrong way as an initial step to passing tests. It's possible this will stay an independent branch for some time and that accumulates unique features.The actual index
Signorm-specific RTLIL methods are implemented in
kernel/rtlil_bufnorm.cc, so is the index:Performance considerations
It seems that the signorm index doesn't differ from the existing indexing going on all over the place and has a lot of persistence potential. To make it persist sanely, it's necessary to replace
swap_namesandrenamewith more expensive object copying that doesn't violate some implicit object identity invariant (loosely "a thing at a pointers won't change what thing in the design it represents", like in #5692). That's still probably worth it and if not it's easier to tackle the overhead of that if traversal is abstracted which is what we're already doing.Early incremental
opt_mergeexperiments were promising but I haven't reproduced those yet or measured anything on this fixed patch.