oqc-community / qat

QAT is a quantum compiler and runtime focused on low-level, just-above-driver integration.
Other
49 stars 11 forks source link

Test coverage: gate decomposition tests #259

Closed lcauser-oqc closed 1 week ago

lcauser-oqc commented 1 week ago

Context: We currently allow -- either via our QuantumInstructionBuilder or parsing QASM2/3 files -- many different gates, that are ultimately implemented through decomposition down to the native gates typically available on hardware. While we have some tests that indirectly check some of these gates through simulators (e.g. by inspecting measurement distributions), they are not exhaustive and robust to the subtle details that might distinguish gates (for example, the Rx and Ry gate applied to a |0> state would give the same measurement distribution, but there are phase differences that wont be detected). Having more robust tests will allow us to move forwards with more trust in our internal and external definitions of gates. The most complete way to compare decompositions of gates against their standard definitions would be to compare unitary matrices of decomposed circuits against their expected outcomes.

These tests also detected that our implementation of the Hadamard gate at the level of the builder is incorrect (this is not a problem when running QASM programs due to the its overloaded definition).

Changes:

Tests currently fail as we need the QASM3 patch on main first :smile:

github-actions[bot] commented 1 week ago

Performance Regression Tests

Performance changes detected in the following benchmarks: none

Pusher: @lcauser-oqc, Action: pull_request, Workflow: Performance regression tests