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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Removed

Fixed
-----
- Fix issue with skip_transpiler causing some gates to be ignored silently.


`0.5.4`_ - 2018-06-11
Expand Down
4 changes: 3 additions & 1 deletion qiskit/_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

"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.

job["compiled_circuit"] = DagUnroller(
DAGCircuit.fromQuantumCircuit(circuit),
JsonBackend(job['config']['basis_gates'].split(','))).execute()
JsonBackend(basis_all.split(','))).execute()
else:
if initial_layout is None and not backend.configuration['simulator']:
# if coupling_map is not already satisfied, pick a good initial layout
Expand Down