oqc-community / qat

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

Incorrect implementation of capture in openpulse #112

Open jfriel-oqc opened 1 month ago

jfriel-oqc commented 1 month ago

Incorrect implementation of capture in openpulse. caputre_v2 signature specifies: extern capture_v2(frame output, waveform filter) -> bit;

however the filter is not accepted as a waveform but as a float. This comes from live data format and the echo data format returns being different so passes test suites, but fails on live hardware. Returning Results: {'Exception': 'TypeError("unsupported operand type(s) for /: \'NoneType\' and \'float\'")'}

Would expect a measurement bit result to be returned.

Example code:

from qat.qat import execute_with_metrics
from qat.purr.backends.echo import get_default_echo_hardware

hw = get_default_echo_hardware(3)

frame_measure = "r2_measure"
frame_aquire = "r2_acquire"

program = f"""
OPENQASM 3;
defcalgrammar "openpulse";

cal {{
      extern frame {frame_measure};
      extern frame {frame_aquire};
      waveform wf1 = gaussian(1.0, 18ns, 0.20);

}}

defcal measure $2 {{
      barrier {frame_measure}, {frame_aquire};
      play({frame_measure}, wf1);
      capture_v2({frame_aquire},0.000001);
      return 1;
}}
measure $2;
"""

result = execute_with_metrics(program, hardware=hw)

Note, this code works for echo engine, but fails on live hardware.