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

Compiler remaps when no remapping is needed #1655

Closed
quantumjim opened this issue Jan 9, 2019 · 3 comments
Closed

Compiler remaps when no remapping is needed #1655

quantumjim opened this issue Jan 9, 2019 · 3 comments

Comments

@quantumjim
Copy link
Member

Informations

  • Qiskit Terra version: 0.7
  • Python version:
  • Operating system:

What is the current behavior?

See this notebook. A circuit is made containing cnots that can be directly implemented on a device. The compiler then remaps this to different qubits for which the cnots are not directly possible, and adds in extra cnots to compensate.

Steps to reproduce the problem

See the notebook above.

What is the expected behavior?

The compiler should realize that using qubit n of the device for qubit n of the circuit will prevent the need for any swap gates.

Suggested solutions

Suppling a trivial initial_layout removes the problem, but I don't think it should be needed.

@jaygambetta
Copy link
Member

Im not sure this is a bug but clearly the passes need to be better.

Some options to worry about it.

  1. If you know that the gates exists then use circuit_to_qobj instead of compile (maybe only master for this)
    -- qobj = compile(qc,backend)
  2. give the pass_manger as an input that is empty to compile so that it does not go through the transpiler.

@quantumjim
Copy link
Member Author

Thanks Jay. To me it feels like a bug because it used to work but now it doesn't, and not because of any intentional deprecation (I assume).

I should also have mentioned: my workaround does not work for batch jobs that include circuits of different sizes (due to decisions made it #704, it seems). So that's why it remained an issue for me.

Your solution (here's an explicit snippet for posterity)

from qiskit.transpiler import PassManager
qobj = compile([qc,qc2],backend,pass_manager=PassManager())

does work in this case. So I'm happy to accept this is the way to do things now, and will close.

@ajavadia
Copy link
Member

Hi James this is fixed via #1499, but this pass is currently not part of the default PassManager. It will be in the next release.

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

No branches or pull requests

3 participants