Skip to content

Conversation

tanujkhattar
Copy link
Collaborator

Part of #5028

Since SwapPermutationReplacer is not exposed outside the file, we don't need to go through the deprecation cycle

@tanujkhattar tanujkhattar requested review from a team, vtomole and cduck as code owners June 30, 2022 00:39
@tanujkhattar tanujkhattar requested a review from mpharrigan June 30, 2022 00:39
@CirqBot CirqBot added the size: S 10< lines changed <50 label Jun 30, 2022
@@ -307,7 +297,7 @@ def compile_circuit(
# as well, we allow this to be passed in. This compiler is not allowed to
# change the order of the qubits.
return CompilationResult(
circuit=compiler(swap_networks[0].circuit), mapping=mapping, parity_map=parity_map
Copy link
Collaborator

@vtomole vtomole Jul 6, 2022

Choose a reason for hiding this comment

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

Why was swap_networks[0].circuit being passed in in the first place instead of routed_circuit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because the original optimizer mutated the circuit. routed_circuit was a variable storing a reference to swap_networks[0].circuit and since the underlying circuit was being mutated; it didn't matter whether you pass swap_networks[0].circuit or routed_circuit.

Now, routed_circuit stores a modified copy of swap_networks[0].circuit and therefore we need to pass routed_circuit instead of swap_networks[0].circuit.

Copy link
Collaborator

@vtomole vtomole left a comment

Choose a reason for hiding this comment

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

LGTM

@tanujkhattar tanujkhattar merged commit 63aaa9c into master Jul 6, 2022
@vtomole vtomole deleted the remove_swap_permutation_replacer branch July 6, 2022 23:34
rht pushed a commit to rht/Cirq that referenced this pull request May 1, 2023
harry-phasecraft pushed a commit to PhaseCraft/Cirq that referenced this pull request Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants