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

add ECR gate and approximation_degree option #5609

Merged
merged 27 commits into from
Mar 30, 2021
Merged

Conversation

ajavadia
Copy link
Member

@ajavadia ajavadia commented Jan 12, 2021

Adds a new 2-qubit gate, the echo cross-resonance (ECR), which is two CR(π/4) pulses with an X gate between them for the echo. This gate is locally equivalent to a CNOT (can convert to a CNOT with local pre- or post-rotation). It is the native gate on current IBM hardware and compiling to it allows the pre-/post-rotations to be merged into the rest of the circuit.

Additionally a new option is added to the transpiler for approximate synthesis of unitaries. The synthesis fidelity can be given to the transpiler. This capability was already there in the synthesizer, it is just now exposed to the transpiler.

@ajavadia ajavadia requested review from manoelmarques, woodsp-ibm and a team as code owners January 12, 2021 04:07
@ajavadia ajavadia added the Changelog: New Feature Include in the "Added" section of the changelog label Jan 12, 2021
@ajavadia ajavadia force-pushed the ecr-gate branch 2 times, most recently from 21597ad to 5b9fa5a Compare January 21, 2021 04:19
Copy link
Member

@kdk kdk left a comment

Choose a reason for hiding this comment

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

Looks good, two small test comments, but otherwise, good to go.

@levbishop
Copy link
Member

levbishop commented Feb 4, 2021

"Synthesis fidelity" is not a good description of the parameter. "Basis fidelity" is better. The actual meaning of the parameter is that it assumes each use of the 2-qubit basis gate has the given gate fidelity, and trades that off with the approximation fidelity. For example if the target gate is the small fractional SWAP exp(0.0647 i (xx+yy+zz)) then with basis_fidelity=0.9966 the decomposer will prefer the 0.99 gate fidelity 0-CNOT product decomposition in preference to the perfect 3-CNOT decomposition, whereas in this case I would say the "synthesis fidelity" is 0.9900

@ajavadia
Copy link
Member Author

ajavadia commented Feb 8, 2021

"Synthesis fidelity" is not a good description of the parameter. "Basis fidelity" is better. The actual meaning of the parameter is that it assumes each use of the 2-qubit basis gate has the given gate fidelity, and trades that off with the approximation fidelity. For example if the target gate is the small fractional SWAP exp(0.0647 i (xx+yy+zz)) then with basis_fidelity=0.9966 the decomposer will prefer the 0.99 gate fidelity 0-CNOT product decomposition in preference to the perfect 3-CNOT decomposition, whereas in this case I would say the "synthesis fidelity" is 0.9900

Yes but I wanted to somehow avoid making this too specific to this pass. I'm trying to add a knob to the high-level "transpile" command that allows users to control approximation degree. You can imagine this knob can be useful in things like compiling to a discrete gate set, or using approximate QFT, or whatnot. I know this particular pass makes its approximation decision based on finding a sweet spot in the tradeoff between applying more gates and fidelity of synthesis. So I'd be open to suggestions for a general name. Would "approximation_degree" be good?

@levbishop
Copy link
Member

I know this particular pass makes its approximation decision based on finding a sweet spot in the tradeoff between applying more gates and fidelity of synthesis. So I'd be open to suggestions for a general name. Would "approximation_degree" be good?

Wouldn't finding a sweet spot between gates fidelity and synthesis fidelity be fairly generic also to things like Solovay-Kitaev or whatever? I would argue that some interpretation basis_fidelity could/should be used in many/most circumstances.

@ajavadia
Copy link
Member Author

Ok I think I understand what you mean. You're saying the minimum basis fidelity that would make a difference to your approximation is basis_gate of 0.4 fidelity.

That's even though the approximation itself can go lower than 0.4 in the Weyl chamber:

average_gate_fidelity(SwapGate(), CXGate()) = 0.25

I'm happy to do whatever you prefer here. I do want to make a follow up PR where I make the basis_fidelity reference those from backend.properties() if available, so that each gate can be approximated according to its own basis fidelity. It should only fall back on this generic approximation_degree in the absence of cal information.

@levbishop
Copy link
Member

After optimizing over single-qubit pre/post rotation max_{pre/post} F_avg(SWAP, CX) == 0.4

@levbishop
Copy link
Member

perhaps the right thing is to require that approximation-aware synthesis methods expose an approximation_degree kwarg as well as whatever their domain-specific kwarg such as basis_fidelity, or rtol, or search_depth or whatever. Each synthesis method can check that it only receives at most one such kwarg and can do its own domain-specific mapping from the 0<=approximation_degree<=1 range to their native parameter?

@ajavadia
Copy link
Member Author

Yes I think something like that makes sense, a pass-specific parameter and a generic parameter that can be mapped to that for each pass. I can do this for the 2-qubit synthesizer in the follow-up PR.

kdk
kdk previously approved these changes Mar 29, 2021
kdk
kdk previously approved these changes Mar 29, 2021
@mergify mergify bot merged commit 346ffa8 into Qiskit:master Mar 30, 2021
mtreinish added a commit to mtreinish/qiskit-core that referenced this pull request Mar 30, 2021
mergify bot pushed a commit that referenced this pull request Apr 1, 2021
* Prepare 0.17.0 release

To prepare for the upcoming 0.17.0 release this commit moves all the
release notes into a 0.17 subdirectory to keep them separate from future
development notes post-release. It also adds an incomplete release note
to add the prelude section providing the high level overview of the
release. When this merges it should be the commit used to tag the 0.17.0
release.

* Add feature note for aqua migrated modules

* Update release notes abd add piecewise chebyshev to docs and library export

* Update more release notes and add abstract pass classes to docs

* More release note updates

* Update more release notes and add clifford_decompose to api docs

* Add RZXCalibration pass and templates to docs and update release notes

* Update more release notes

* Fix typo in decompose_clifford imports and release notes

* Fix docs build

* Add hellinger_distance to docs

* Add RZXCalibrationBuilder to the docs

* More release note updates

* Fix import error

* Fix RZXCalibrationBuilder docstring

* Finish updating the new feature release notes

* Fix lint

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Move new release notes to 0.17 dir and update

* Fix RVGate docs and start updating upgrade notes

* Fix PauliGate example circuit visualization

* Fix typo

* More release note updates

* Update meas_map release note again

* Fix whitespace in meas_map release note

* Fix docs build

* Update almost all of the upgrade notes

* Add latex to docs job env

* Revert "Add latex to docs job env"

This reverts commit 8080cb5.

* Remove latex drawing from the release notes

Getting the texlive distribution with qcircuit installed in CI is
proving problematic in the interest of time and finishing the other
releasenotes instead of relying on it this just changes the latex drawer
jupyter execute to be a code block and not depend on being able to run
pdftlatex at docs build time.

* Remove fix note for unreleased feature

* Move and update new release notes

* Remove unnecessary upgrade note about internal API changes

* More release note updates

* More release note updates

* Even more release note updates

* Fix syntax error

* Fix docs build

* Move new release notes and fix docs issues from #5609

* Update more release notes

* Move new release notes

* More release note updates

* Finish fixes notes

* Fix docs build

* Update more relaese notes

* Apply suggestions from code review

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* More note fixes

* Update new release notes

* Apply suggestions from code review

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* Move and update new release notes

* Apply suggestions from code review

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* cleaning up docs for vqe

* clean up extend

* Fix reno merge commit error

* Revert accidental tox.ini change

* Tweak release note wording

* Move and update new release notes

* Attempt to retrigger azure

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Lauren Capelluto <laurencapelluto@gmail.com>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
Co-authored-by: Jay Gambetta <jay.gambetta@us.ibm.com>
ElePT pushed a commit to ElePT/qiskit that referenced this pull request Jun 27, 2023
* Prepare 0.17.0 release

To prepare for the upcoming 0.17.0 release this commit moves all the
release notes into a 0.17 subdirectory to keep them separate from future
development notes post-release. It also adds an incomplete release note
to add the prelude section providing the high level overview of the
release. When this merges it should be the commit used to tag the 0.17.0
release.

* Add feature note for aqua migrated modules

* Update release notes abd add piecewise chebyshev to docs and library export

* Update more release notes and add abstract pass classes to docs

* More release note updates

* Update more release notes and add clifford_decompose to api docs

* Add RZXCalibration pass and templates to docs and update release notes

* Update more release notes

* Fix typo in decompose_clifford imports and release notes

* Fix docs build

* Add hellinger_distance to docs

* Add RZXCalibrationBuilder to the docs

* More release note updates

* Fix import error

* Fix RZXCalibrationBuilder docstring

* Finish updating the new feature release notes

* Fix lint

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Move new release notes to 0.17 dir and update

* Fix RVGate docs and start updating upgrade notes

* Fix PauliGate example circuit visualization

* Fix typo

* More release note updates

* Update meas_map release note again

* Fix whitespace in meas_map release note

* Fix docs build

* Update almost all of the upgrade notes

* Add latex to docs job env

* Revert "Add latex to docs job env"

This reverts commit 8080cb5.

* Remove latex drawing from the release notes

Getting the texlive distribution with qcircuit installed in CI is
proving problematic in the interest of time and finishing the other
releasenotes instead of relying on it this just changes the latex drawer
jupyter execute to be a code block and not depend on being able to run
pdftlatex at docs build time.

* Remove fix note for unreleased feature

* Move and update new release notes

* Remove unnecessary upgrade note about internal API changes

* More release note updates

* More release note updates

* Even more release note updates

* Fix syntax error

* Fix docs build

* Move new release notes and fix docs issues from Qiskit#5609

* Update more release notes

* Move new release notes

* More release note updates

* Finish fixes notes

* Fix docs build

* Update more relaese notes

* Apply suggestions from code review

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* More note fixes

* Update new release notes

* Apply suggestions from code review

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* Move and update new release notes

* Apply suggestions from code review

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* cleaning up docs for vqe

* clean up extend

* Fix reno merge commit error

* Revert accidental tox.ini change

* Tweak release note wording

* Move and update new release notes

* Attempt to retrigger azure

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Lauren Capelluto <laurencapelluto@gmail.com>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
Co-authored-by: Jay Gambetta <jay.gambetta@us.ibm.com>
ElePT pushed a commit to ElePT/qiskit-algorithms-test that referenced this pull request Jul 17, 2023
* Prepare 0.17.0 release

To prepare for the upcoming 0.17.0 release this commit moves all the
release notes into a 0.17 subdirectory to keep them separate from future
development notes post-release. It also adds an incomplete release note
to add the prelude section providing the high level overview of the
release. When this merges it should be the commit used to tag the 0.17.0
release.

* Add feature note for aqua migrated modules

* Update release notes abd add piecewise chebyshev to docs and library export

* Update more release notes and add abstract pass classes to docs

* More release note updates

* Update more release notes and add clifford_decompose to api docs

* Add RZXCalibration pass and templates to docs and update release notes

* Update more release notes

* Fix typo in decompose_clifford imports and release notes

* Fix docs build

* Add hellinger_distance to docs

* Add RZXCalibrationBuilder to the docs

* More release note updates

* Fix import error

* Fix RZXCalibrationBuilder docstring

* Finish updating the new feature release notes

* Fix lint

* Apply suggestions from code review

Co-authored-by: Julien Gacon <gaconju@gmail.com>

* Move new release notes to 0.17 dir and update

* Fix RVGate docs and start updating upgrade notes

* Fix PauliGate example circuit visualization

* Fix typo

* More release note updates

* Update meas_map release note again

* Fix whitespace in meas_map release note

* Fix docs build

* Update almost all of the upgrade notes

* Add latex to docs job env

* Revert "Add latex to docs job env"

This reverts commit 8080cb58ea0c0faad270197c61d2cececff8da1e.

* Remove latex drawing from the release notes

Getting the texlive distribution with qcircuit installed in CI is
proving problematic in the interest of time and finishing the other
releasenotes instead of relying on it this just changes the latex drawer
jupyter execute to be a code block and not depend on being able to run
pdftlatex at docs build time.

* Remove fix note for unreleased feature

* Move and update new release notes

* Remove unnecessary upgrade note about internal API changes

* More release note updates

* More release note updates

* Even more release note updates

* Fix syntax error

* Fix docs build

* Move new release notes and fix docs issues from Qiskit/qiskit#5609

* Update more release notes

* Move new release notes

* More release note updates

* Finish fixes notes

* Fix docs build

* Update more relaese notes

* Apply suggestions from code review

Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>

* More note fixes

* Update new release notes

* Apply suggestions from code review

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* Move and update new release notes

* Apply suggestions from code review

Co-authored-by: Kevin Krsulich <kevin@krsulich.net>

* cleaning up docs for vqe

* clean up extend

* Fix reno merge commit error

* Revert accidental tox.ini change

* Tweak release note wording

* Move and update new release notes

* Attempt to retrigger azure

Co-authored-by: Julien Gacon <gaconju@gmail.com>
Co-authored-by: Lauren Capelluto <laurencapelluto@gmail.com>
Co-authored-by: Naoki Kanazawa <nkanazawa1989@gmail.com>
Co-authored-by: Kevin Krsulich <kevin@krsulich.net>
Co-authored-by: Jay Gambetta <jay.gambetta@us.ibm.com>
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.

CXDirection pass should not generate gates outside basis_gates
3 participants