-
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 basis equivalence test to be more specific (#6532)
This commit updates the basis translator test: test_skip_target_basis_equivalences_1 to be more speific to the case it was designed to test. It was originally added in #6369 as a dedicated reproduce test to validate we fixed issue #6350 where the basis translator was trying to translate a gate already in the basis set which resulted in a less than ideal (but still valid) output circuit. However, this test was written to just mirror the original issue which was part of a larger workflow and is too broad for a dedicated test case. This is primarily because it was running a full transpile against a backend with the sabre swap routing pass instead of only running the basis translator (which is what we're testing). To fix this issue with the test this commit extracts the qasm from the transpilation into the basis translator when running the full reproduce from the original issue and uses that as the input circuit, then the test is updated to only run basis translation and optimization instead of the full transpilation against a backend. This makes the test more targetted to what it's specifically for and stable against unrelated changes to the sabre swap pass. Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
4c15d9e
commit 4b27c63
Showing
2 changed files
with
106 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
OPENQASM 2.0; | ||
include "qelib1.inc"; | ||
qreg q[5]; | ||
h q[0]; | ||
cu1(4.1564508) q[2],q[1]; | ||
swap q[0],q[1]; | ||
swap q[1],q[2]; | ||
cx q[3],q[2]; | ||
tdg q[2]; | ||
swap q[3],q[4]; | ||
cx q[3],q[2]; | ||
t q[2]; | ||
swap q[4],q[3]; | ||
cx q[3],q[2]; | ||
tdg q[2]; | ||
t q[3]; | ||
swap q[3],q[4]; | ||
cx q[3],q[2]; | ||
t q[2]; | ||
h q[2]; | ||
cx q[3],q[4]; | ||
t q[3]; | ||
tdg q[4]; | ||
cx q[3],q[4]; | ||
swap q[2],q[3]; | ||
rzz(0.48622471) q[2],q[1]; | ||
ch q[1],q[2]; | ||
t q[1]; | ||
swap q[0],q[1]; | ||
id q[2]; | ||
swap q[1],q[2]; | ||
h q[4]; | ||
cx q[3],q[4]; | ||
swap q[3],q[2]; | ||
tdg q[4]; | ||
cx q[3],q[4]; | ||
swap q[2],q[3]; | ||
t q[4]; | ||
cx q[3],q[4]; | ||
t q[3]; | ||
swap q[3],q[2]; | ||
tdg q[4]; | ||
cx q[3],q[4]; | ||
cx q[3],q[2]; | ||
tdg q[2]; | ||
t q[3]; | ||
cx q[3],q[2]; | ||
y q[3]; | ||
t q[3]; | ||
h q[3]; | ||
swap q[2],q[3]; | ||
t q[4]; | ||
h q[4]; | ||
cu3(2.5787688,1.3265772,3.1398664) q[4],q[3]; | ||
tdg q[3]; | ||
cx q[3],q[2]; | ||
tdg q[2]; | ||
swap q[2],q[1]; | ||
cx q[0],q[1]; | ||
t q[1]; | ||
swap q[3],q[2]; | ||
cx q[2],q[1]; | ||
tdg q[1]; | ||
cx q[0],q[1]; | ||
t q[1]; | ||
h q[1]; | ||
t q[2]; | ||
swap q[2],q[1]; | ||
cx q[0],q[1]; | ||
t q[0]; | ||
tdg q[1]; | ||
cx q[0],q[1]; | ||
u3(4.8520889,3.6025647,5.7475542) q[0]; | ||
rz(2.1885681) q[0]; | ||
cx q[1],q[2]; | ||
h q[1]; | ||
cx q[2],q[1]; | ||
tdg q[1]; | ||
swap q[1],q[2]; | ||
y q[4]; | ||
cz q[3],q[4]; | ||
cx q[3],q[2]; | ||
t q[2]; | ||
cx q[1],q[2]; | ||
t q[1]; | ||
tdg q[2]; | ||
cx q[3],q[2]; | ||
t q[2]; | ||
h q[2]; | ||
swap q[2],q[3]; | ||
cx q[2],q[1]; | ||
tdg q[1]; | ||
t q[2]; | ||
cx q[2],q[1]; | ||
swap q[1],q[2]; | ||
cx q[3],q[2]; | ||
cu3(2.7675189,4.5725211,2.9940136) q[1],q[2]; | ||
rx(5.976651) q[4]; | ||
cx q[4],q[3]; |
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