Skip to content

[Synth] Add SOP balancing pass for delay optimization#9511

Merged
uenoku merged 1 commit intollvm:mainfrom
uenoku:dev/hidetou/sop-rebase-2
Jan 27, 2026
Merged

[Synth] Add SOP balancing pass for delay optimization#9511
uenoku merged 1 commit intollvm:mainfrom
uenoku:dev/hidetou/sop-rebase-2

Conversation

@uenoku
Copy link
Member

@uenoku uenoku commented Jan 26, 2026

This commit introduces a new pass, SOPBalancing, in the Synth dialect to perform delay optimization by restructuring And-Inverter Graphs (AIGs) through sum-of-products (SOP) balancing. The implementation is based on the algorithm described in "Delay Optimization Using SOP Balancing" by Mishchenko et al. (ICCAD 2011), which derives ISOP representations for cuts, balances SOP expressions to minimize critical path delay, and selects optimal cuts based on delay-area trade-offs.

The pass uses cut-based rewriting and is disabled by default for now. There are several improvements necessary for CutRewriter framework to make it practical.

This commit introduces a new pass, SOPBalancing, in the Synth dialect to perform delay optimization by restructuring And-Inverter Graphs (AIGs) through sum-of-products (SOP) balancing. The implementation is based on the algorithm described in "Delay Optimization Using SOP Balancing" by Mishchenko et al. (ICCAD 2011), which derives ISOP representations for cuts, balances SOP expressions to minimize critical path delay, and selects optimal cuts based on delay-area trade-offs.

Specifically, the changes add the getInputArrivalTimes method to the Cut class for computing input delays, define the SOPBalancing pass with configurable options such as the maximum cut input size, integrate the pass into the synthesis optimization pipeline with a disable option, add the command-line flag --enable-sop-balancing to the circt-synth tool as an opt-in pass.

The pass uses cut-based rewriting and is disabled by default for conservative adoption.
@uenoku uenoku force-pushed the dev/hidetou/sop-rebase-2 branch from 7cf8b26 to fc4498e Compare January 26, 2026 07:41
Copy link
Contributor

@fabianschuiki fabianschuiki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Really cool that circt-synth is growing some delay optimizations 🥳

//
// First, determine which variables are actually used in the SOP by
// collecting a bitmask from all cubes.
uint64_t mask = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the cube mask guaranteed to fit within 64 bits?

Copy link
Member Author

@uenoku uenoku Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realistically yes because truth tables grow exponentially (2^n entries for n variables), so practical limits are much lower than 64. I'll add a check in CutRewriter in a follow-up.

// COMMON-NEXT: Found 168 paths
// COMMON-NEXT: Found 32 unique end points
// AIG-NEXT: Maximum path delay: 32
// AIG-NEXT: Maximum path delay: 27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice 😏

@uenoku uenoku merged commit 43900b9 into llvm:main Jan 27, 2026
7 checks passed
Arya-Golkari pushed a commit to Arya-Golkari/circt that referenced this pull request Feb 7, 2026
This commit introduces a new pass, SOPBalancing, in the Synth dialect to perform delay optimization by restructuring And-Inverter Graphs (AIGs) through sum-of-products (SOP) balancing. The implementation is based on the algorithm described in "Delay Optimization Using SOP Balancing" by Mishchenko et al. (ICCAD 2011), which derives ISOP representations for cuts, balances SOP expressions to minimize critical path delay, and selects optimal cuts based on delay-area trade-offs.

Specifically, the changes add the getInputArrivalTimes method to the Cut class for computing input delays, define the SOPBalancing pass with configurable options such as the maximum cut input size, integrate the pass into the synthesis optimization pipeline with a disable option, add the command-line flag --enable-sop-balancing to the circt-synth tool as an opt-in pass.

The pass uses cut-based rewriting and is disabled by default for conservative adoption.
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