Fix RNG-compatibility of Sabre for large sizes #12172
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The recent Sabre refactor (gh-11977, 3af3cf5) inadvertently switched the order that physical qubits were considered when modifying the front layer after a swap insertion. This could occasionally have an impact in the swap-chooser and extended-set population, if a swap enabled two separate gates at once.
Details and comments
The reason that this changed is that before #11977 we looked at the two physical qubits of the swap in this order, but before we swapped them. After #11977 we look at them afterwards, so to maintain RNG compatibility, we should look at them in the reverse order.
ASV flagged modifications in the depths and sizes (and mostly corresponding changes in the timings) following #11977 that were unexpected. Timing the large-scale passes on my laptop is a little volatile because of other stuff it's doing and thermal throttling, but I can easily verify that this PR fixes the RNG variance.
Commit 4ff0fa2 is
main
before #11977. Commit 3af3cf5 is #11977. Commit 902557f is this PR. I ran theLargeQuantumVolume
benches and the QUEKO benches (which are in the changed set), and first up we can reproduce the changes caused by #11977:Then we can see that the diff from #11977 to this PR inverts that:
and then finally the diff between 4ff0fa2 and this PR shows no change.