-
Notifications
You must be signed in to change notification settings - Fork 31
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
@@ -329,6 +330,7 @@ | |||
'UpdateDataPass', | |||
'ToU3Pass', | |||
'ScanningGateRemovalPass', | |||
'TreeScanningGateRemovalPass', |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
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:
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.