-
Notifications
You must be signed in to change notification settings - Fork 396
[circt-synth] Implemented AIG node balancing algorithm #8262
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
uenoku
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really great! Thank you for working on this!! It's really nice to separate the balancing into two separate passes. What do you think replacing the existing LowerVariadic pass with your BlanceVariadic pass? I think it makes sense to me always run if it's always beneficial
|
I appreciate your feedback and suggestions. Thank you for taking the time to share your review!
The BlanceVariadic pass needs to calculate each node's depth during lowering, it might have runtime issues when the input design has very deep combinational logic. In those kinds of cases, using the existing LowerVariadic will be a good solution to get a usable result in less time. So, I think we should keep the LowerVariadic pass in case anyone has this kind of need. |
uenoku
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, let me test this on a larger design to see if it works!
Co-authored-by: Hideto Ueno <[email protected]>
Co-authored-by: Hideto Ueno <[email protected]>
|
I'm terribly sorry for updating so so late. I will rebase and merge MaxCover pass in this PR separately. I cherry-picked changes/test cases related to balance pass in #9086 to merge existing LowerVariadic pass to basically do the balancing. |
That's fine, and I'm glad to see my implementation can be integrated into the Circt project. Will see what I can do next. |
This implementation is based on a tree-balancing algorithm described in this paper: "https://ieeexplore.ieee.org/abstract/document/6105357". Rebased from #8262. Co-authored-by: Max Zhou <[email protected]>
This implementation is based on a tree-balancing algorithm described in this paper: "https://ieeexplore.ieee.org/abstract/document/6105357". Rebased from #8262. Co-authored-by: Max Zhou <[email protected]>
9f0ac86 to
4207ed7
Compare
I really appreciate your help and sorry again for my delay. I opened #9090 to check CI passes. I can just merge #9090 or I can force-push the commit (under your name) to this PR and merge from this PR if you prefer that. |
Merging the new PR seems more straightforward. That's totally OK with me, and I'll close this PR later. |
This implementation is based on a tree-balancing algorithm described in section 3.1 in the paper: "Delay Optimization Using SOP Balancing, ICCAD 2011". This pass performs maximum AND-cover optimization by collapsing single-fanout and-inverter ops into their users, reducing the depth of And-Inverter Graphs, combined with the lower variadic pass. The pass is integrated into the circt-synth optimization pipeline. Rebased from #8262. Co-authored-by: Max Zhou <[email protected]>
|
Thanks, merged by ed501a8. |
This implementation is based on a tree-balancing algorithm described in this paper: "https://ieeexplore.ieee.org/abstract/document/6105357".
Here is an easy-to-understand example (Which has been added as a test case):

The reference algorithm has two stages, "Covering" and "Tree-balancing," divided into
maximum-and-coverandaig-balance-variadicpasses.A typical usage is:
circt-synth %s --maximum-and-cover --aig-balance-variadic --cse. Themaximum-and-coverpass should be always applied before theaig-balance-variadicpass.