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

fix skip_transpiler: do not remove gates #562

Merged
merged 3 commits into from
Jun 16, 2018

Conversation

ajavadia
Copy link
Member

Summary

The skip_transpiler flag was silently removing gates that did not match a backend's basis set. This PR fixes that.

Details and comments

@@ -126,9 +126,11 @@ def compile(circuits, backend,
if skip_transpiler: # Just return the qobj, without any transformation or analysis
job["config"]["layout"] = None
job["compiled_circuit_qasm"] = circuit.qasm()
basis_all = "id,u0,u1,u2,u3,x,y,z,h,s,sdg,t,tdg,rx,ry,rz," \
"cx,cy,cz,ch,crz,cu1,cu3,swap,ccx,cswap"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember seeing many other places where we have similar basis gates definition hardcoded as well, I guess we could review this in the near future and find out a way to have a unique source for it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atilag yes, this definitely has to change. It's ugly and bugs like this pop up. It's on my list to go through all the code and change this. But that's for a future PR.

@atilag atilag merged commit 87b8ea6 into Qiskit:master Jun 16, 2018
@@ -126,9 +126,11 @@ def compile(circuits, backend,
if skip_transpiler: # Just return the qobj, without any transformation or analysis
job["config"]["layout"] = None
job["compiled_circuit_qasm"] = circuit.qasm()
basis_all = "id,u0,u1,u2,u3,x,y,z,h,s,sdg,t,tdg,rx,ry,rz," \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can avoid defining basis_all by doing,

if skip_transpiler:  # Just return the qobj, without any transformation or analysis
            job["config"]["layout"] = None
            dag_circuit = DAGCircuit.fromQuantumCircuit(circuit)
            job["compiled_circuit_qasm"] = dag_circuit.qasm(qeflag=True,
                                                            eval_symbols=True)
            job["compiled_circuit"] = DagUnroller(dag_circuit,
                                                  JsonBackend(dag_circuit.basis)).execute()

ewinston added a commit to ewinston/qiskit that referenced this pull request Jun 18, 2018
in pr Qiskit#562 a basis string constant was defined which seems like could be avoided.
ajavadia pushed a commit that referenced this pull request Jun 18, 2018
in pr #562 a basis string constant was defined which seems like could be avoided.
@ajavadia ajavadia deleted the fix/skip-transpiler-basis-unroll branch July 21, 2018 00:01
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
…-unroll

fix skip_transpiler: do not remove gates
lia-approves pushed a commit to edasgupta/qiskit-terra that referenced this pull request Jul 30, 2019
in pr Qiskit#562 a basis string constant was defined which seems like could be avoided.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants