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

Adding a TreeScan Gate Removal pass to parallelize Scanning Gate #240

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jkalloor3
Copy link
Contributor

For several circuits of medium width 7-20ish qubits, GPU-enhanced QFactor allows us to run instantiation quickly in order to do a large-block ScanningGate removal. For these workflows, there are very few blocks, which limits our parallelism. In order to fix this, this PR adds a tree structure to ScanningGate removal. The TreeScan works as follows:

  1. Split the circuit operations into chunks of size tree_depth
  2. At every iteration:
    a. Look at the next chunk of operations
    b. Generate 2 ^ tree_depth circuits. Each circuit corresponds to every combination of whether or not to include one of the operations in the chunk.
    c. Instantiate in parallel all 2^tree_depth circuits
    d. Choose the circuit that has the least number of operations and move on to the next chunk of operations.

This optimization is less greedy than the current ScanningGate removal, which we see can offer much better quality circuits than ScanningGate. In very rare occasions, ScanningGate may be able to outperform TreeScan (since it is still greedy), but in general we can expect TreeScan to almost always outperform ScanningGate.

Copy link
Member

@edyounis edyounis left a comment

Choose a reason for hiding this comment

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

Good PR. Minor changes requested

bqskit/passes/processing/treescan.py Outdated Show resolved Hide resolved
bqskit/passes/processing/treescan.py Outdated Show resolved Hide resolved
bqskit/passes/processing/treescan.py Show resolved Hide resolved
bqskit/passes/processing/treescan.py Show resolved Hide resolved
bqskit/passes/processing/treescan.py Outdated Show resolved Hide resolved
bqskit/passes/processing/treescan.py Outdated Show resolved Hide resolved
bqskit/passes/processing/treescan.py Show resolved Hide resolved
bqskit/passes/processing/treescan.py Outdated Show resolved Hide resolved
bqskit/passes/processing/treescan.py Outdated Show resolved Hide resolved
@@ -329,6 +330,7 @@
'UpdateDataPass',
'ToU3Pass',
'ScanningGateRemovalPass',
'TreeScanningGateRemovalPass',
Copy link
Member

Choose a reason for hiding this comment

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

Also add the to the documentation docstring in this file

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does that just mean adding the TreeScanningGateRemovalPass where I did in my latest commit?

@jkalloor3 jkalloor3 requested a review from edyounis May 15, 2024 21:35
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.

None yet

2 participants