[Synth] Implement operation reuse for LowerVariadic#9850
[Synth] Implement operation reuse for LowerVariadic#9850
Conversation
There was a problem hiding this comment.
Cool, thank you for sending for PR! Can we make this an option of the pass for area/timing trade off? Note that there are failures in LEC but this change itself is not at fault. This patch exposed a bug in other pass, let me investigate :) Ah it seems there is a correctness issue with the current implementation. Let me extract a counterexample.
|
Hi @uenoku, I believe I'm almost done with making it O(N). I have a question, you asked me to make it part of an option. Did you mean I should create a new option that enables this specific optimization, or should I use an existing one? |
|
Yes please add a new option to . |
|
@uenoku I have updated the pass to use a map of the available andInverterOp operations in the block. I have also added a new option, reuse-subsets as a guard to the new code. But I have a question about it, how to enable the option in |
|
Could you conditionally pass the option here when circt/lib/Dialect/Synth/Transforms/SynthesisPipeline.cpp Lines 84 to 88 in ba22599 |
|
Done. I see that |
This patch implements a subset-sharing heuristic in the LowerVariadic pass, as suggested in Issue #9712.
Currently, the LowerVariadic pass lowers variadic operations into binary trees independently, leading to redundant AIG gates.
I added a greedy subset-matching heuristic. Before a variadic
aig.and_invis lowered to a binary tree, the pass scans the current block for existing operations of the same type. Checks if the operation is a strict subset of the current one. Substitute the operands with the result of the other operation.Example
For the testcase:
The output is: