-
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.
Update randomised transpiler-equivalence test strategies (#7980)
This commit updates the strategies used to do the randomised testing of transpiler equivalence, having three main effects: 1. The "pre-transpilation" circuit is now run on an Aer backend without any transpilation at all, making the test truer to its name. Previously `execute` was used which secretly performs a transpilation internally. This was accompanied by a small change to the set of gates, to ensure only those that are directly supported by Aer are used. 2. The strategies used for drawing gates are simplified into (mostly) a single rule that draws a gate from a set, and populates it. This is just tidying up - it unifies the logic for drawing a gate into one strategy rather than several. 3. The tests are updated to avoid using deprecated behaviour (e.g. back-referencing a register from a bit) or features (e.g. various old gate classes, and the old Aer `qasm_simulator`). Point 1 in this list is also a fix to recent randomised testing failures; since the tests were updated in ff4ee1b to call `backend.run` directly (rather than `execute`) in the second run of each circuit, when Hypothesis was drawing `None` as the backend in conjunction with a gate Aer didn't know how to simulate (e.g. `CRZGate`), Aer would raise an exception. Previously this behaviour was hidden by the internal call to `transpile` inherent in `execute`, and was a logic error in the test suite, rather than in Terra. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4211b5b
commit 27ef0d6
Showing
1 changed file
with
36 additions
and
103 deletions.
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