-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Deprecate LinearFunctionsSynthesis transpiler pass #9041
Deprecate LinearFunctionsSynthesis transpiler pass #9041
Conversation
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:
|
Pull Request Test Coverage Report for Build 3943107070
💛 - Coveralls |
qiskit/transpiler/passes/synthesis/linear_functions_synthesis.py
Outdated
Show resolved
Hide resolved
qiskit/transpiler/passes/synthesis/linear_functions_synthesis.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Matthew Treinish <mtreinish@kortar.org>
@@ -20,7 +20,7 @@ | |||
from qiskit.circuit import QuantumCircuit, Qubit, Clbit | |||
from qiskit.transpiler.passes.optimization import CollectLinearFunctions | |||
from qiskit.transpiler.passes.synthesis import ( | |||
LinearFunctionsSynthesis, | |||
HighLevelSynthesis, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should maintain some tests of the old pass to ensure it works as is during the deprecation period.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added a test that the old functionality still works and a bug fix (shame on me, I did break the functionality), see 0309abe. I believe that a single test suffices, since most of the tests actually check the orhogonal block collection aspect of resynthesizing linear functions.
There was also a suggestion to extend the @combine(do_commutative_analysis=[False, True])
to something like@combine(do_commutative_analysis=[False, True], synthesis_pass=[HighLevelSynthesis, LinearFunctionsSynthesis])
, however I did not end up using this since in one case we want to call
synthesized_circuit = PassManager(synthesis_pass()).run(optimized_circuit)
and in the other case we want to call
with self.assertWarns(DeprecationWarning):
synthesized_circuit = PassManager(synthesis_pass()).run(optimized_circuit)
and I did not think of a clever way to nicely combine the two.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding the test
Summary
We already have a high-level-synthesis transpiler pass that is able to synthesize linear functions using the plugin interface. The original
LinearFunctionsSynthesis
transpiler pass is no longer needed, and we have decided to deprecate it.In addition,
LinearFunctionsSynthesis
was previously based on thedefinition
method provided inLinearFunction
(which calls the specificcnot_synth
algorithm). This may lead to confusion, as it does not use the synthesis plugin interface specified underlinear_function.default
inentry_points
.This PR starts the deprecation clock on
LinearFunctionsSynthesis
, and temporarily reimplements as a special case ofHighLevelSynthesis
(using the synthesis method specified underlinear_function.default
inentry_points
).Additionally comments:
The
LinearFunctionsSynthesis
is not used in the transpilation flow, astranspile
callsHighLevelSynthesis
and notLinearFunctionsSynthesis
.Currently
LinearFunction
inherits fromGate
(which eventually inherits fromOperation
). We have decided that it's fine to keep it this way.