-
Notifications
You must be signed in to change notification settings - Fork 404
[Synth] Enhance LowerVariadic pass with timing-aware optimization #9086
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
Extend the LowerVariadic pass to handle all commutative operations (and, or, xor, mul, add) from the comb dialect, not just AndInverter ops. The new implementation uses a delay-aware algorithm that builds balanced binary trees by combining values with the earliest arrival times first, minimizing critical path delay. This is implemented with a priority queue that orders values by their arrival time as computed by the IncrementalLongestPathAnalysis. Co-authored-by: Max Zhou <[email protected]>
|
Apologies didn't get to this today - will try and look at it in a few hours before I head off for a holiday - but looks really great and will probably get rid of an annoying defeat vs Yosys in the benchmarking |
No rush! |
cowardsa
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.
LGTM - had one query around lowering ands and ors to trees - but then you had already covered it later on - so please ignore that comment.
Only query would be to check that there is a LEC test (couldn't find one in a brief scan) for potentially a larger variadic lowering test?
| /// Construct a balanced binary tree from a variadic operation using a | ||
| /// delay-aware algorithm. This function builds the tree by repeatedly combining | ||
| /// the two values with the earliest arrival times, which minimizes the critical | ||
| /// path delay. | ||
| static LogicalResult replaceWithBalancedTree( |
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.
Non-blocking - could this also be used in CombToSynth as we perform variadic reduction there too?
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.
Good points, yes. I think it makes sense to eventually move the utility to Synth header and use it from CombToSynth. Though it might be slightly weird because CombToSynth doesn't have timing info at this point. I'll find a way to unify them.
| // AIG-NEXT: Maximum path delay: 32 | ||
| // MIG-NEXT: Maximum path delay: 32 | ||
| // LUT6-NEXT: Maximum path delay: 6 |
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.
Cool to see this test keep getting refined to track progress
Extend the LowerVariadic pass to handle all commutative operations (and, or, xor, mul, add) from the comb dialect, not just AndInverter ops.
The new implementation uses a delay-aware algorithm that builds balanced binary trees by combining values with the earliest arrival times first, minimizing critical path delay. This is implemented with a priority queue that orders values by their arrival time as computed by the IncrementalLongestPathAnalysis.
Co-authored-by: Max Zhou [email protected]
Fix #9066