RZ and RX fidelity are assumed to be equal, resulting in suboptimal ISA for compilation
Pre-Report Checklist
- [x] I am running the latest versions of pyQuil and the Forest SDK
- [x] I checked to make sure that this bug has not already been reported
Issue Description
Some gates have mathematically equivalent decompositions into native gates that vary in terms of the fidelity of the actual pulse program. For example, RY(pi/2) 0 may equivalently decompose into
RZ(-pi/2) 34
RX(pi/2) 34
RZ(pi/2) 34
or
RX(pi/2)
RZ(pi/2)
RX(-pi/2)
Rigetti's hardware-native RZ gates are currently virtual, so these two implementations are not equivalent from the perspective of pulses hitting the device. The side effect is that the XZX implementation will have a higher error rate than ZXZ in practice.
While it might make sense generally to ascribe an error rate to RZ explicitly, for the purposes of compilation I think it makes sense to assume RZ is perfect, and that all errors wash out in the playing of subsequent RX operations.
How to Reproduce
Running the following:
from pyquil import get_qc
qc = get_qc("Aspen-11")
p = Program()
p += RY(np.pi / 2, 0)
print(qc.compiler.quil_to_native_quil(p))
will either produce
RZ(-pi/2) 34
RX(pi/2) 34
RZ(pi/2) 34
or
RX(pi/2)
RZ(pi/2)
RX(-pi/2)
However, the second (worse) option is more likely. It's possible this could be corrected on the quilc side, but it's probably not reasonable to bias one way or another assuming that RX and RZ have the same fidelity.
https://github.com/rigetti/qcs-sdk-rust/issues/33 opened to make the implementation consistent across SDKs.
:tada: This issue has been resolved in version 3.2.0-rc.2 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket:
:tada: This issue has been resolved in version 3.2.0 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: