-
Notifications
You must be signed in to change notification settings - Fork 37
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
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
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.
You did not address a few comments from the previous review. I am not a fan of how GitHub collapses the comments, so you probably missed them. You might need to expand the ones in the middle. Let me know if you need help here.
Otherwise, it looks much better. All of my comments this time around were focused on the documentation. We should make sure the code you write is properly documented; it will ensure others can use, maintain, and expand your code. Once you push up a commit, you can check how the documentation looks by clicking on the readthedocs CI check.
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.