Add generate_clifford_t_pass_manager#15918
Add generate_clifford_t_pass_manager#15918alexanderivrii wants to merge 7 commits intoQiskit:mainfrom
generate_clifford_t_pass_manager#15918Conversation
reno and docs
|
One or more of the following people are relevant to this code:
|
| rz_synthesis_error: float | None = None, | ||
| rz_cache_error: float | None = None, |
There was a problem hiding this comment.
I would expect this to go under the umbrella of generic synthesis arguments. Once we add a plugin here we'll need to accommodate for this, plus other synthesis methods might handle caching differently. Could we just call this rz_synthesis_config and make it a generic dictionary to pass into the synthesis method?
There was a problem hiding this comment.
That was mainly to show that we now can add Clifford+T pipeline-specific arguments (and because you have asked for this for comparing against other tools). But I agree that we need to think a bit more about how synthesis and Clifford+T should look.
Cryoris
left a comment
There was a problem hiding this comment.
Some high level comments, I didn't read the logic yet 🙂
| basis_gates (list): List of basis gate names to unroll to. | ||
| coupling_map (CouplingMap): Directed graph representing a coupling | ||
| map. |
There was a problem hiding this comment.
Could we ditch these and just use a Target instead? Or is there a reason to use these as standalone?
There was a problem hiding this comment.
In theory, we can, however I am personally so used to generate preset pass managers while specifying basis_gates and coupling_map manually, that I would miss this functionality. However, based on our offline discussion, I have removed backend as an argument (especially that we have no such backends at the moment).
Summary
This PR introduces a function
generate_clifford_t_pass_managerwhich is analogous togenerate_preset_pass_managerbut exposes arguments specifically tailored for Clifford+T compilation. In particular it does not have arguments such asinit_stageoroptimization_stagebut has argumentsrz_synthesis_errorandrz_cache_errorrelevant to synthesizing RZ-gates to Clifford+T basis set.The previously existing ways of instantiating a Clifford+T transpiler pipeline (via
transpileorgenerate_preset_pass_managerwith a Clifford+T basis set) are still supported, however using the new function is recommended.Details and comments
I have defined the following classes:
PassManagerCliffordTConfig, which is analogous toPassManagerConfigbut tailored for Clifford+T. Currently it subclassesPassManagerConfigas Clifford+T compilation pipeline (not changed in this PR) uses default layout, routing and scheduling stages. (Actually the only place which really needs this to be a subclass isDefaultRoutingPassManagerwhich callsSabreSwapPassManager, which assumes that config includeslayout_method. And I did not want to explicitly addlayout_methodtoPassManagerCliffordTConfigas per previous discussions we might want to completely change how layout and routing look for Clifford+T compilations).PassManagerCliffordTStagePlugin, which is analogous toPassManagerCliffordTStagePlugin, but tailored for Clifford+T compilation.Both of the above classes are internal for now (not exposed in the documentation on purpose) since we might want to further refactor them when the PBC compilation pipeline will be added.