-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Control flow instructions don't work with circuit_to_instruction
#11379
Comments
This needs to be an error in practice; there's no way to communicate the creg / variable requirements of an Totally agree that the error message should be way better. |
Really, |
@jakelishman This used to work well until version 0.45.0 |
There should be no need to use |
There's no particular guarantee that any classical handling was working correctly before if |
We didn't get this done for 1.0, so we'll have to revisit for 1.1 and see what's reasonable for us to do within the stability policy. |
circuit_to_instruction
@jakelishman @mtreinish I can work on this. I just need clarification if the fix would be to remove the |
The notebook "Tomography of quantum teleportation" had the issue "Invalid clbits for condition x" at transpilation with Qiskit 1.3 during HighLevelSynthesis with c_if() conditions. To merge the two circuits of the notebooks, QuantumCircuit.append() was used. But in this Github issue it's recommended to use QuantumCircuit.compose() instead : Qiskit/qiskit#11379 (comment) To make it work we had to change the size of the sub-circuit to be the same at the other one (3 qubits and 3 classical bits). Moving to QuantumCircuit.compose() fixed the error with the conditions. Refs: #8785
The notebook "Tomography of quantum teleportation" had the issue "Invalid clbits for condition x" at transpilation with Qiskit 1.3 during HighLevelSynthesis with c_if() conditions. To merge the two circuits of the notebooks, QuantumCircuit.append() was used. But in this Github issue it's recommended to use QuantumCircuit.compose() instead : Qiskit/qiskit#11379 (comment) To make it work we had to change the size of the sub-circuit to be the same at the other one (3 qubits and 3 classical bits). Moving to QuantumCircuit.compose() fixed the error with the conditions. Refs: #8785
The notebook "Tomography of quantum teleportation" had the issue "Invalid clbits for condition x" at transpilation with Qiskit 1.3 during HighLevelSynthesis with c_if() conditions. To merge the two circuits of the notebooks, QuantumCircuit.append() was used. But in this Github issue it's recommended to use QuantumCircuit.compose() instead : Qiskit/qiskit#11379 (comment) To make it work we had to change the size of the sub-circuit to be the same at the other one (3 qubits and 3 classical bits). Moving to QuantumCircuit.compose() fixed the error with the conditions. Refs: #8785
Environment
What is happening?
Trying to convert a circuit with a control flow operation in it to an instruction using
qiskit.converters.circuit_to_instruction
fails while processing the control flow condition. It is treating it like ac_if
legacy style condition even for control flow ops and this causes it to fail with aNotImplementedError
because the function is trying to callc_if
.How can we reproduce the issue?
What should happen?
We either should have a descriptive error saying we can't nest control flow operations in an instruction or update the
.condition
handling incircuit_to_instruction
to understand a control flow operation.Any suggestions?
No response
The text was updated successfully, but these errors were encountered: