Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Exhaustive greedy rewrite strategy #151

Merged
merged 6 commits into from
Oct 11, 2023
Merged

Conversation

aborgna-q
Copy link
Collaborator

This is a straight combination of the greedy and exhaustive strategies. Instead of applying each strategy separately, apply each one once but also include all the following strategies that do not modify the same nodes.

This is a draft, since for some reason combining multiple strategies at once is invalidating the hugr.
They may not be correctly reporting their modified nodes ?

@aborgna-q aborgna-q changed the title feat: Exhaustive greedy strategy feat: Exhaustive greedy rewrite strategy Sep 29, 2023
@aborgna-q
Copy link
Collaborator Author

aborgna-q commented Oct 11, 2023

This requires CQCL/hugr#600 to check whether the rewrites are non-overlapping.

We get really nice results.

On my laptop, 1 thread, barenco_tof_10, 60s timeout, queue size 500:

Base cost: 192 CX gates, 326 gates.

  • Using HEAD:

    • Min cost: (135, 269)
    • 281 circuits processed / 28k seen
    • Peak memory usage: 508MB
  • With this branch:

    • Min cost: (120, 260)
    • 340 circuits processed / 24k seen
    • Peak memory usage: 427 MB

It's specially noticeable on short timeouts; we beat HEAD with cost (132, 268) in 5 seconds.

@aborgna-q aborgna-q marked this pull request as ready for review October 11, 2023 11:50
Copy link
Contributor

@lmondada lmondada left a comment

Choose a reason for hiding this comment

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

Excellent!

@aborgna-q aborgna-q added this pull request to the merge queue Oct 11, 2023
Merged via the queue into main with commit cf6ccf9 Oct 11, 2023
7 checks passed
@aborgna-q aborgna-q deleted the feat/greedy-strats branch October 11, 2023 14:50
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