Preserve i->i initial layout when coupling_map satisfied#527
Conversation
There was a problem hiding this comment.
Do we really want to remove this kwarg? For backward compatibility, should it not implicitly set skip_transpiler and raise a depreciation warning saying that it will be removed in the future?
There was a problem hiding this comment.
For a two qubit gate between qubits i and j, I thought the check would be if j is in coupling_map[i] or if i in coupling_map[j]. Is that what is going on here, or (more likely) am I missing something?
There was a problem hiding this comment.
This checks for exact match, meaning if there is a CX(q[i], q[j]) in the circuit, it checks that the device also has CX(q[i], q[j]) in it. The reason is that I want to keep already-matching circuits untouched, but pass any other ones through the mapper. A good mapper may actually find a more compact circuit, but usually a user that writes an already-matching circuit wants to use those exact qubits.
There was a problem hiding this comment.
Yeah, I found this confusing at first, because I thought that the coupling_map was an adjacency list, but it's not. It more a list of coupled pairs: coupling_map = [[1, 0], [2, 0], [2, 1], [3, 2], [3, 4], [4, 2]].
There was a problem hiding this comment.
Yes, your right. This is what we want.
b98f728 to
ee466d3
Compare
8e6feca to
9ae25f8
Compare
* Preserve i->i initial layout when already satisfied. * skip_translation deprecated in favor of skip_transpiler.
When a circuit already satisfies the coupling_map on the backend, the swap_mapper should not insert any swaps. This means passing an
initial_layoutofq[i]->q[i].PR #478 optimizes the initial layout, but that creates unexpected behavior when the coupling map is already satisfied. Here, I only apply the optimization of #478 if swaps are indeed needed.
The other thing that this PR does is a slight name change:
skip_translation->skip_transpiler, to get ready for the transpiler PR.Motivation and Context
Issue was raised here:
https://quantumexperience.ng.bluemix.net/qx/community/question?questionId=5b0d17f943fb6e0038a623bf
Screenshots (if appropriate):
Types of changes
Checklist: