Skip to content

Conversation

@gaborszita
Copy link
Contributor

Closes #447

Example:

Block before optimize Block after optimize (without my changes) Block after optimize (with my changes)
image image image

@codecov
Copy link

codecov bot commented Jan 12, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.0%. Comparing base (5077c24) to head (4306a00).
Report is 21 commits behind head on development.

Additional details and impacted files
@@              Coverage Diff              @@
##           development    #462     +/-   ##
=============================================
+ Coverage         91.7%   92.0%   +0.3%     
=============================================
  Files               24      24             
  Lines             6403    6470     +67     
=============================================
+ Hits              5866    5946     +80     
+ Misses             537     524     -13     

☔ 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.

Copy link
Member

@fdxmw fdxmw left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this issue! A couple high-level comments before we get into coding details:

  1. O(N^2) nested for loops over block.logic should generally be avoided in passes because they don't scale well as the number of nets increases - the pass will take too long to run. It seems possible to iterate over block.logic once and build a list of all the inverter chains in the block (see how other passes create a _ProducerList for example). Then I think we can iterate over that list and decide if each inverter chain can be simplified?
  2. This really needs a test :) Some test cases that come to mind:
    1. Chains of 1, 2, 3, and 4 inverters (even numbers of inverters should be removed, and odd numbers of inverters should be simplified to one inverter)
    2. A chain of 2 inverters with another user of the first inverter's output (should not be simplified)

@gaborszita
Copy link
Contributor Author

Thank you for fixing this issue! A couple high-level comments before we get into coding details:

  1. O(N^2) nested for loops over block.logic should generally be avoided in passes because they don't scale well as the number of nets increases - the pass will take too long to run. It seems possible to iterate over block.logic once and build a list of all the inverter chains in the block (see how other passes create a _ProducerList for example). Then I think we can iterate over that list and decide if each inverter chain can be simplified?

  2. This really needs a test :) Some test cases that come to mind:

    1. Chains of 1, 2, 3, and 4 inverters (even numbers of inverters should be removed, and odd numbers of inverters should be simplified to one inverter)
    2. A chain of 2 inverters with another user of the first inverter's output (should not be simplified)

All addressed

@gaborszita gaborszita requested a review from fdxmw January 17, 2025 22:24
Copy link
Member

@fdxmw fdxmw left a comment

Choose a reason for hiding this comment

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

Please start with the comments on line 109 and 81 first. If those can be addressed, they will probably make many other comments obsolete. Thank you for improving this code!

@gaborszita
Copy link
Contributor Author

I will fix these next week, I was busy this weekend.

@fdxmw
Copy link
Member

fdxmw commented Jan 27, 2025

I will fix these next week, I was busy this weekend.

Sounds great, no rush! Let me know if you have any questions about my comments, happy to discuss.

@gaborszita gaborszita requested a review from fdxmw March 5, 2025 00:57
@gaborszita gaborszita requested a review from fdxmw March 6, 2025 01:38
Copy link
Member

@fdxmw fdxmw left a comment

Choose a reason for hiding this comment

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

Overall structure of this pull request looks great, so we are on to fine details at this point. We're almost there, thank you for your patience!

@gaborszita
Copy link
Contributor Author

Sorry for not squashing my commits, I forgot I already had commits locally when I pushed.

Copy link
Member

@fdxmw fdxmw left a comment

Choose a reason for hiding this comment

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

This should be the last round of comments, thank you for your patience!

Copy link
Member

@fdxmw fdxmw left a comment

Choose a reason for hiding this comment

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

Looks great, thank you for all your effort on this pull request!

@fdxmw fdxmw merged commit d5f8dbe into UCSBarchlab:development Mar 25, 2025
5 checks passed
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.

Optimize is currently missing the elimination of "double not"

2 participants