Skip to content

Conversation

uenoku
Copy link
Member

@uenoku uenoku commented Sep 20, 2025

Previously, GreedyPatternRewriter was naively used to bit-blast multi-bit values but it didn't scale well due to worklist iteration and unnecessary IR creation which occasionally ended up with constant values. Hence the pass was often not scalable for large designs.

This commit fixes the issue by applying constant propagation during the bit-blast process and replaces GreedyPatternRewriter with a manual one-shot walk with recursion.

…prop

Previously, GreedyPatternRewriter was naively used to bit-blast multi-bit
values but it didn't scale well due to worklist iteration and unnecessary
IR creation which occasionally ended up with constant values. Hence the pass
was often not scalable for large designs.

This commit fixes the issue by applying constant propagation during the
bit-blast process and replaces GreedyPatternRewriter with a manual one-shot
walk with recursion. Key improvements:

- Rename Driver class to BitBlaster for better clarity
- Complete rewrite from pattern-based approach to sophisticated algorithm
- Implement known bits analysis for efficient constant propagation
- Add comprehensive statistics collection and performance metrics
- Enhance bit extraction logic with intelligent caching mechanisms
- Support full range of operations: AIG, MIG, and combinatorial ops
- Improve error handling with combinational cycle detection
- Preserve debugging information with name hint propagation

The new implementation provides significant scalability improvements through
bit-sensitive constant propagation, enabling more efficient synthesis of
large multi-bit operations by avoiding unnecessary computations on
constant bits.
@uenoku uenoku force-pushed the dev/hidetou/lower-word-to-bits-prop branch from 0d8ac6d to f627ee1 Compare September 20, 2025 09:26
@uenoku uenoku changed the title [Synth]LowerWordsToBits: Improve scalability with bit-sensitive constprop [Synth] LowerWordsToBits: Improve scalability with bit-sensitive constprop Sep 20, 2025
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! Cool to see the per-bit constant propagation prune out some unneeded ops 😄

@uenoku uenoku merged commit a4d4b1c into main Sep 22, 2025
7 checks passed
@uenoku uenoku deleted the dev/hidetou/lower-word-to-bits-prop branch September 22, 2025 17:46
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