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

QMaskFusion #874

Merged
merged 54 commits into from
Aug 31, 2021
Merged

QMaskFusion #874

merged 54 commits into from
Aug 31, 2021

Conversation

WrathfulSpatula
Copy link
Collaborator

This adds a new gate fusion layer, which will typically sit as a layer just above QPager or QEngine. The inspiration was this paper, "Faster Schrödinger-style simulation of quantum circuits":

https://arxiv.org/abs/2008.00216

To paraphrase, one of the optimizations emphasized in that paper is making sure to pad gates with as few identity operations as possible, to avoid redundant traversals of the state vector. To this end, we add XMask(), YMask(), and ZMask(), which can efficiently apply multiple Pauli gates at once on different qubit indices, with a single state vector traversal. To take full advantage of this optimization, particularly in the default "optimal" layer stack, we insert the QMaskFusion layer at the appropriate level of the stack, to coalesce and fuse Pauli operators.

This does not cover multi-qubit-gate-fusion, yet, except for parallel Pauli operations. Another fusion layer, potentially closer in design to the original QFusion, might sit above QUnit, ultimately.

@WrathfulSpatula WrathfulSpatula changed the title QMaskFusion WIP: QMaskFusion Aug 29, 2021
@WrathfulSpatula WrathfulSpatula changed the title WIP: QMaskFusion QMaskFusion Aug 30, 2021
@WrathfulSpatula
Copy link
Collaborator Author

I'm trying benchmarks quickly, before merging, but I'm probably not going to be too unpleasantly surprised.

@WrathfulSpatula WrathfulSpatula changed the title QMaskFusion WIP: QMaskFusion Aug 31, 2021
@WrathfulSpatula
Copy link
Collaborator Author

This is still unstable, in the benchmark suite.

@WrathfulSpatula WrathfulSpatula changed the title WIP: QMaskFusion QMaskFusion Aug 31, 2021
@WrathfulSpatula
Copy link
Collaborator Author

The remaining bug was in QHybrid. We failed to match GPU/CPU modes, in QHybrid::ShuffleBuffers(), if the modes of the two engines to shuffle started mismatched.

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

1 participant