Skip to content

Fix depth-preserving rewrite and depth view#691

Merged
MyskYko merged 13 commits into
lsils:masterfrom
MyskYko:fix_rw2
May 11, 2026
Merged

Fix depth-preserving rewrite and depth view#691
MyskYko merged 13 commits into
lsils:masterfrom
MyskYko:fix_rw2

Conversation

@MyskYko

@MyskYko MyskYko commented May 10, 2026

Copy link
Copy Markdown
Collaborator

More extensive fix for #687.
Depth view now has public helper functions to compute the node level and required level using the given cost function.
I considered adding ALAP (#555) to depth view, but its recursion seems less efficient than reverse topological order traversal using topo view.

Level update is now first attempted by recurring the fanouts, and when it finds reconvergence, it falls back on topological order traversal from the sink nodes, collected by a couple of fanin/fanout recursions. I hope this is not too bad for performance.

Required level computation now records required levels of new nodes. This greatly helps runtime for MIG rewrite from AIGs of arithmetic functions (e.g., multiplier.aig). Didn't look into detailed profiles, but I guess creating many new nodes in the reconvergence regions caused the problem, requiring multiple traversals through them.

One note is that the current (and previous) required level computation is quite conservative. Update happens only when the previous required level is looser. For exact update, we need to check all fanouts, and the recursive approach will likely encounter performance issue. We may do something similar to what I did for level computation here. Or there may be a cleverer way by maintaining a topological order throughout optimization. I'll leave it for now.

@codecov

codecov Bot commented May 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.01961% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.21%. Comparing base (fa8513a) to head (2b3f12c).
⚠️ Report is 6 commits behind head on master.

Files with missing lines Patch % Lines
include/mockturtle/views/depth_view.hpp 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #691      +/-   ##
==========================================
+ Coverage   83.83%   84.21%   +0.38%     
==========================================
  Files         189      189              
  Lines       29888    29068     -820     
==========================================
- Hits        25056    24481     -575     
+ Misses       4832     4587     -245     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@MyskYko
MyskYko merged commit 88a8ac9 into lsils:master May 11, 2026
18 checks passed
@MyskYko
MyskYko deleted the fix_rw2 branch May 16, 2026 11:21
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