Closed nonhermitian closed 4 years ago
I think I agree with building the graph concurrently with the circuit as it gets built (see https://github.com/Qiskit/qiskit-terra/issues/1088#issuecomment-432299954).
But the rest of these is blurring a lot of lines IMO and will lead to difficult maintenance. A circuit should know nothing about a backend. It should just exist independently. Similarly, optimization passes are better handled separately over the entire circuit. For example mapping , which relies on layers, which can change as the circuit gets built.
So my vote is for closing this and tracking in #1088.
So my idea was to be able to optionally hint to a circuit what backend it was going to be compiled for. Something akin to type hinting in source code. Then we could validate on the fly. Simple things like h or cx cancellations can be done at build time where others, as you point out, need the full circuit. So the point was to just try to do as much as possible using other threads/processes as possible when constructing circuits. However this does add layers of complexity.
I don't think that optimization should be done at construction time. What do you mean by validation @nonhermitian ?
Things like, does this circuit width fit on the destination backend, are all the gates supported, does the circuit depth / gate count fit on the device, etc
On Oct 25, 2018, at 14:42, Luciano notifications@github.com wrote:
I don't think that optimization should be done at construction time. What do you mean by validation @nonhermitian ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
This issue seems outdated (last update was more than a year ago) to our current vision:
So I'm closing it. But feel free to reopen it (or create a new issue referencing to this one) if there is something still valid about it.
What is the expected enhancement?
Currently a quantum circuit is built, then compiled to a DAG, and then passed through the transpiler before being send to a backend. However, it is possible to construct the DAG, and run basic optimizations on the circuit (or hint that optimizations can be performed) in parallel with the circuits construction. In addition, provided that a backend is specified, we can check that a circuit is valid for a given backend (e.g. correct gate set, within depth and/or gate restrictions, etc) before it is actually passed to the backend, or in some cases even fully constructed. A sketch of such a workflow is below: