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

Deprecates StochasticSwap and suggests the use of SabreSwap #12983

Merged
merged 17 commits into from
Aug 20, 2024

Conversation

danielbultrini
Copy link
Contributor

@danielbultrini danielbultrini commented Aug 19, 2024

Summary

I added depreciation warnings for issue #12552 and modified unit tests to capture the new errors. Documentation with examples has also been added.

Details and comments

I have added a deprecation warning to the StochasticSwap class and a description of how to change things. All relevant tests were made to capture the warning, but some tests which check all different types of these passes (i.e. Sabre, look ahead) where split so that the stochastic method may easily be removed in future. In one class of test (test_mappers.py) StochasticSwap had to be removed, as the method used to run the tests made it prohibitively hard to easily check for warnings in the stochastic case exclusively.

@danielbultrini danielbultrini requested a review from a team as a code owner August 19, 2024 12:18
@qiskit-bot qiskit-bot added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Aug 19, 2024
@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 following people are relevant to this code:

  • @Qiskit/terra-core

@CLAassistant
Copy link

CLAassistant commented Aug 19, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@danielbultrini danielbultrini changed the title Fixes #12552 Deprecates StochasticSwap and suggests the use of SabreSwap Aug 19, 2024
@1ucian0 1ucian0 added the Changelog: Deprecation Include in "Deprecated" section of changelog label Aug 19, 2024
Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Thanks a lot @danielbultrini, the PR looks really good, I just added a tiny suggestion for a typo, and you need to sign the CLA agreement mentioned in the comment above for us to be able to merge it into Qiskit!

(note that you can apply the suggestion directly by clicking on the "Commit suggestion" button under it)

qiskit/transpiler/passes/routing/stochastic_swap.py Outdated Show resolved Hide resolved
@danielbultrini
Copy link
Contributor Author

Thanks @ElePT ! After a bit more work, all tests passed. I signed the CLA, but for some reason it's still showing as unsigned (although another bot comment says it's signed). It was a great learning experience to go through this process

Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

Thanks again @danielbultrini :) The PR is almost there, I just added a few minor comments to polish the final details. I think that the CLA shouldn't be an issue, as the license CI check passes. As you have seen, deprecations can be trickier to handle than they seem, so this is really good work!!

qiskit/transpiler/passes/routing/stochastic_swap.py Outdated Show resolved Hide resolved
test/python/compiler/test_transpiler.py Outdated Show resolved Hide resolved
test/python/transpiler/test_mappers.py Outdated Show resolved Hide resolved
test/python/compiler/test_transpiler.py Outdated Show resolved Hide resolved
test/python/compiler/test_transpiler.py Outdated Show resolved Hide resolved
test/python/compiler/test_transpiler.py Outdated Show resolved Hide resolved
test/python/compiler/test_transpiler.py Outdated Show resolved Hide resolved
test/python/transpiler/test_mappers.py Outdated Show resolved Hide resolved
Copy link
Contributor

@ElePT ElePT left a comment

Choose a reason for hiding this comment

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

I just applied some minor suggestions for the wording of the TODOs, and I think we are good to go!! Approving the PR :)

@ElePT ElePT enabled auto-merge August 20, 2024 09:32
@ElePT ElePT linked an issue Aug 20, 2024 that may be closed by this pull request
4 tasks
@ElePT ElePT added this to the 1.3.0 milestone Aug 20, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 10469003353

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.03%) to 89.576%

Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/two_qubit_decompose.rs 1 90.69%
crates/qasm2/src/lex.rs 2 91.98%
Totals Coverage Status
Change from base Build 10459812488: 0.03%
Covered Lines: 67591
Relevant Lines: 75457

💛 - Coveralls

@ElePT ElePT added this pull request to the merge queue Aug 20, 2024
github-merge-queue bot pushed a commit that referenced this pull request Aug 20, 2024
* first attempt to fix issue 12552

* first attempt to fix issue 12552

* fixed issue 12552 and unittest

* formatted and completed 12552

* formatted and completed 12552 documentation

* fixed unit tests 12552

* Update qiskit/transpiler/passes/routing/stochastic_swap.py

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* linted

* passed all tests, including compiler test

* final linting and unittest passing - hopefully

* Update qiskit/transpiler/passes/routing/stochastic_swap.py

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* Update releasenotes/notes/deprecate-StochasticSwap-451f46b273602b7b.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* added test

* Apply suggestions from code review

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Aug 20, 2024
@ElePT ElePT added this pull request to the merge queue Aug 20, 2024
Merged via the queue into Qiskit:main with commit d430e58 Aug 20, 2024
15 checks passed
github-merge-queue bot pushed a commit that referenced this pull request Aug 20, 2024
* tiny follow up

* Update releasenotes/notes/deprecate-StochasticSwap-451f46b273602b7b.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
mergify bot pushed a commit that referenced this pull request Aug 20, 2024
* tiny follow up

* Update releasenotes/notes/deprecate-StochasticSwap-451f46b273602b7b.yaml

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>
(cherry picked from commit b90c7a7)

# Conflicts:
#	qiskit/transpiler/passes/routing/stochastic_swap.py
#	releasenotes/notes/deprecate-StochasticSwap-451f46b273602b7b.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: Deprecation Include in "Deprecated" section of changelog Community PR PRs from contributors that are not 'members' of the Qiskit repo
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

deprecate StochasticSwap
6 participants