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

Synthesis of a Clifford circuit into layers #9220

Merged
merged 40 commits into from
Jan 11, 2023

Conversation

ShellyGarion
Copy link
Member

@ShellyGarion ShellyGarion commented Dec 1, 2022

Summary

This PR decompose a Clifford into 8 layers of 1-qubit and 2-qubit gates.
There are two layers of CZ gates, and one layer of CX gates.
This PR provides a similar construction to Lemma 8 of https://arxiv.org/abs/2003.09412.

co-authored by @alexanderivrii.

Details and comments

The aim is to decompose a Clifford for LNN (linear nearest neighbor) connectivity, see #9036

This PR will be followed by two other PRs for LNN connectivity:

Both of these PRs will allow to decompose a Clifford circuit in depth 7n over LNN connectivity.

This code has been used in: https://arxiv.org/abs/2212.03937

@ShellyGarion ShellyGarion requested review from a team and alexanderivrii as code owners December 1, 2022 10:22
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Dec 1, 2022

Pull Request Test Coverage Report for Build 3890612257

  • 150 of 169 (88.76%) changed or added relevant lines in 3 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 84.641%

Changes Missing Coverage Covered Lines Changed/Added Lines %
qiskit/synthesis/clifford/clifford_decompose_layers.py 136 155 87.74%
Files with Coverage Reduction New Missed Lines %
src/sabre_swap/layer.rs 2 98.95%
Totals Coverage Status
Change from base Build 3889495451: 0.04%
Covered Lines: 64472
Relevant Lines: 76171

💛 - Coveralls

@ShellyGarion ShellyGarion added this to the 0.24.0 milestone Dec 29, 2022
@ShellyGarion ShellyGarion modified the milestones: 0.24.0, 0.23.0 Jan 2, 2023
@ShellyGarion ShellyGarion changed the title [WIP] Synthesis of a Clifford circuit into layers Synthesis of a Clifford circuit into layers Jan 3, 2023
Copy link
Contributor

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thanks Shelly for driving this development. This is an important decomposition for Clifford circuits that I know many people are eagerly waiting for being available in Qiskit.

I am not sure that I should be the one officially approving this PR, since I am listed as a co-author. I have included a few minor comments, mostly about documentation.

I am also no longer sure that we need the new LayeredCircuit class. Initially it seemed a good idea since the decomposition algorithm produces the final circuit which consists of multiple subcircuits (aka "layers"), including a layer consisting only of Hadamard gates, a layer consisting only of CX-gates. a layer consisting only of CZ-gates, etc. And thus it seemed a good idea that we should first create such a layered decomposition, and then apply layer-specific synthesis algorithms to synthesize each layer (e.g., either Patel-Markov-Hayes or Kutin-Moulton-Smithline linear function synthesis algorithm for CX-layers, a CZ-synthesis algorithm for CZ-layers, etc.), but now we are synthesizing these layers eagerly anyway. Bottom line: let's remove the LayeredCircuit class and simply keep a list of QuantumCircuits as you originally had.

Another question is whether we want to use HighLevelSynthesis to synthesize layers instead of calling specific cx_synth_func, etc.? Oh, I have realized that one does not prevent the other, e.g., we can pass cx_synth_func that simply replaces a "CX layer" by LinearFunction, and then HLS would be applicable as a follow-up stage. Which means: there is nothing extra needed to do.

Copy link
Contributor

@eliarbel eliarbel left a comment

Choose a reason for hiding this comment

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

Overall LGTM, with the caveat I didn't get to check the algorithm details... But then I count the unit test to suffice for this purpose. I left a couple minor comments but I don't think those are blockers for merge

qiskit/synthesis/clifford/clifford_decompose_layers.py Outdated Show resolved Hide resolved
qiskit/synthesis/clifford/clifford_decompose_layers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

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

Thanks Shelly! Since I am listed as a co-author on this PR (as I have helped a bit with the initial prototype), I have asked Eli for additional comments. Given that you have also fully addressed his comments, I am marking this as approved.

@ShellyGarion ShellyGarion added Changelog: New Feature Include in the "Added" section of the changelog automerge labels Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: New Feature Include in the "Added" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants