-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
BarrierBeforeFinalMeasurements
deterministic (#9568)
* Make `BarrierBeforeFinalMeasurements` deterministic The barrier-merging step at the end directly converted its inner (unordered) sets of bits into (ordered) lists, which is an operation dependent on `PYTHONHASHSEED`. This can have an impact on subsequent topological iteration orders, if there are any barriers that are not full-width in the circuit, which can in turn cause later stochastic transpiler passes to have different outputs for fixed random seeds, depending on `PYTHONHASHSEED`. * Add direct test of MergeAdjacentBarriers
- Loading branch information
1 parent
38132d8
commit 26886a1
Showing
4 changed files
with
60 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
releasenotes/notes/deterministic-barrier-before-final-measurements-04e817d995794067.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
fixes: | ||
- | | ||
The :class:`.BarrierBeforeFinalMeasurements` and :class:`.MergeAdjacentBarriers` transpiler | ||
passes previously had a non-deterministic order of their emitted :class:`.Barrier` instructions. | ||
This did not change the semantics of circuits but could, in limited cases where there were | ||
non-full-width barriers, cause later stochastic transpiler passes to see a different topological | ||
ordering of the circuit and consequently have different outputs for fixed seeds. The passes | ||
have been made deterministic to avoid this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters