Skip to content

Fix/eslim larger replacement - #607

Open
RyanAmaudruz wants to merge 2 commits into
berkeley-abc:masterfrom
RyanAmaudruz:fix/eslim-larger-replacement
Open

RyanAmaudruz wants to merge 2 commits into
berkeley-abc:masterfrom
RyanAmaudruz:fix/eslim-larger-replacement

Conversation

@RyanAmaudruz

Copy link
Copy Markdown

Summary

Delay-oriented eSLIM optimization can produce replacement networks containing more gates than the original window.

Although replaceInternal already reserves space for larger replacements, its object-count assertion incorrectly compares against the original circuit size.

This PR corrects the assertion bound to account for replacement growth and primary outputs that have not yet been appended. The assertion is retained.

Regression test

Adds a deterministic regression covering:

  • Larger, equal-sized, and smaller replacements
  • Repeated replacement on the same circuit manager
  • Graph consistency and fanin/fanout relationships
  • Exhaustive Boolean equivalence across all input assignments

The test exercises the replacement API directly rather than relying on SAT search to discover a particular replacement.

The regression links against libabc and requires assertions to be enabled. Builds with NDEBUG explicitly skip the test using CTest's SKIP_RETURN_CODE, rather than reporting a misleading pass.

Validation

  • Reproduced the original assertion failure on upstream bde1659cf
  • Confirmed that the unpatched implementation fails and the corrected implementation passes with assertions enabled
  • Fresh Debug build and all 7 configured CTest tests passed
  • Verified with static Debug and shared optimized builds with assertions enabled
  • Confirmed that ordinary Release builds skip the regression
  • AddressSanitizer, UndefinedBehaviorSanitizer, and leak checking passed
  • ABC namespace and checked-STL validation passed

Run the regression with assertions enabled:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build --config Debug --target eslim_replace -j
ctest --test-dir build -C Debug -R '^eslim_replace$' --output-on-failure

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.

1 participant