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

internal error from optimize_1q_gates from conditional cy gate #2571

Closed
kdk opened this issue Jun 4, 2019 · 1 comment · Fixed by #2573
Closed

internal error from optimize_1q_gates from conditional cy gate #2571

kdk opened this issue Jun 4, 2019 · 1 comment · Fixed by #2573
Labels
bug Something isn't working

Comments

@kdk
Copy link
Member

kdk commented Jun 4, 2019

>>> qc = qk.QuantumCircuit(2,2)
>>> qc.cy(0,1).c_if(qc.cregs[0], 0)
<qiskit.circuit.instructionset.InstructionSet object at 0x12c540160>
>>> qk.transpile(qc, backend=FakeTenerife())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kevin.krsulichibm.com/q/qiskit-terra/qiskit/compiler/transpile.py", line 147, in transpile
    circuits = parallel_map(_transpile_circuit, list(zip(circuits, transpile_configs)))
  File "/Users/kevin.krsulichibm.com/q/qiskit-terra/qiskit/tools/parallel.py", line 100, in parallel_map
    return [task(values[0], *task_args, **task_kwargs)]
  File "/Users/kevin.krsulichibm.com/q/qiskit-terra/qiskit/compiler/transpile.py", line 168, in _transpile_circuit
    return transpile_circuit(circuit, transpile_config)
  File "/Users/kevin.krsulichibm.com/q/qiskit-terra/qiskit/transpiler/transpile_circuit.py", line 62, in transpile_circuit
    return pass_manager.run(circuit)
  File "/Users/kevin.krsulichibm.com/q/qiskit-terra/qiskit/transpiler/passmanager.py", line 147, in run
    dag = self._do_pass(pass_, dag, passset.options)
  File "/Users/kevin.krsulichibm.com/q/qiskit-terra/qiskit/transpiler/passmanager.py", line 180, in _do_pass
    new_dag = pass_.run(dag)
  File "/Users/kevin.krsulichibm.com/q/qiskit-terra/qiskit/transpiler/passes/optimize_1q_gates.py", line 53, in run
    raise TranspilerError("internal error")
qiskit.transpiler.exceptions.TranspilerError: 'internal error'
@kdk kdk added the bug Something isn't working label Jun 4, 2019
@mtreinish
Copy link
Member

It looks like this is potentially caused by an issue in dagcircuit.collect_runs() It's supposed to return a list of non-conditional runs of op nodes with the given names. But in the cy().c_if() example above a conditional is being returned which is triggering the if for a condition here: https://github.com/Qiskit/qiskit-terra/blob/master/qiskit/transpiler/passes/optimize_1q_gates.py#L50

mtreinish added a commit to mtreinish/qiskit-core that referenced this issue Jun 4, 2019
This commit adds an additional check that none of the ops output from
the dagcircuit's collect_runs() function do not have a condition. There
is a check on the first op in the run, but we never check if any other
nodes in the run have a condition. A condition on any node in the run
would end the run. This commit fixes the behavior to match this so we
never return a node with a condition on it.

Fixes Qiskit#2571
@1ucian0 1ucian0 assigned 1ucian0 and unassigned 1ucian0 Jun 5, 2019
1ucian0 pushed a commit that referenced this issue Jun 6, 2019
* Ensure collect runs doesn't return an op with a condition

This commit adds an additional check that none of the ops output from
the dagcircuit's collect_runs() function do not have a condition. There
is a check on the first op in the run, but we never check if any other
nodes in the run have a condition. A condition on any node in the run
would end the run. This commit fixes the behavior to match this so we
never return a node with a condition on it.

Fixes #2571
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this issue Jul 30, 2019
* Ensure collect runs doesn't return an op with a condition

This commit adds an additional check that none of the ops output from
the dagcircuit's collect_runs() function do not have a condition. There
is a check on the first op in the run, but we never check if any other
nodes in the run have a condition. A condition on any node in the run
would end the run. This commit fixes the behavior to match this so we
never return a node with a condition on it.

Fixes Qiskit#2571
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants