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

Transpiler should raise when conflicting parameters, not just ignore them silently #4060

Merged
merged 23 commits into from
Apr 2, 2020

Conversation

1ucian0
Copy link
Member

@1ucian0 1ucian0 commented Apr 1, 2020

If transpile is called with pass_manager, most of the additional parameters are already embed in the pass manager configuration and they are currently silently ignored.

This PR raises when that happen and includes a small refactor to reorganize the code.

@1ucian0 1ucian0 added the Changelog: API Change Include in the "Changed" section of the changelog label Apr 1, 2020
@1ucian0 1ucian0 added this to the 0.13 milestone Apr 1, 2020
@ajavadia
Copy link
Member

ajavadia commented Apr 1, 2020

can we just remove the pass_manager kwarg from transpile(circuit, pass_manager)? it's no different than pass_manager.run(circuit). It was only included temporarily for backwards compatibility, but if you already have the passmanager you shouldn't have to call transpile. The transpile function is there to select an appropriate passmanager based on some desired transpilation criteria.

This is in the docstring:

        pass_manager: The pass manager to use for a custom pipeline of transpiler passes.
            If this arg is present, all other args will be ignored and the
            pass manager will be used directly (Qiskit will not attempt to
            auto-select a pass manager based on transpile options).

@1ucian0
Copy link
Member Author

1ucian0 commented Apr 1, 2020

can we just remove the pass_manager kwarg from transpile(circuit, pass_manager)? it's no different than pass_manager.run(circuit). It was only included temporarily for backwards compatibility, but if you already have the passmanager you shouldn't have to call transpile. The transpile function is there to select an appropriate passmanager based on some desired transpilation criteria.

Agree. Let's depreate the parameter in this PR too!

@1ucian0 1ucian0 requested a review from ewinston as a code owner April 1, 2020 13:28
Luciano Bello added 2 commits April 1, 2020 11:12
@mergify mergify bot merged commit 9d404a9 into Qiskit:master Apr 2, 2020
faisaldebouni pushed a commit to faisaldebouni/qiskit-terra that referenced this pull request Aug 5, 2020
…them silently (Qiskit#4060)

* Qiskit#4003 (review)

* cast circuit parameter as a list sooner than later

* multiple circuits for passmanager.run

* remove pass_manager from the transpile_args

* set default optimization in a single place

* conflicting args

* lint

* reno

* lint!

* empty pass manager is a pass manager

* other redundant param

* deprecate parameter

* remove deprecated tranpile call from test.python.transpiler

* remove deprecated tranpile call from test.python.compiler

* last fix

* unsed import

* test/python/circuit/test_unitary.py

* unused import

* execute

* lint

* reno

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Changelog: API Change Include in the "Changed" section of the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants