‘classical’ Dialect#

A classical real-time dialect for co-processing at QPU runtime

The classical dialect describes the classical services a pulse program calls while the QPU runs: functions on a GPU, a host or an FPGA that decode syndromes, update calibrations or receive bulk readout data, and whose answers later pulses can use.

A call is two timed events. classical.submit sends the request on the device’s link, a linear value like a line, so the requests on one link go out in program order. classical.wait is the point where the answer is needed; it is ready a bounded latency after the request is sent. Pulses that do not depend on the answer are not delayed by it.

classical.callable declares a function: its name (whose 32-bit FNV-1a hash identifies it on the wire), the link it is reached on, the types of its arguments and results, and its latency.

classical.callable @decode {dispatch_key = 3007678287 : i64, device = 0 : i64,
    args = ["bits:2"], results = ["bits:1"],
    latency_min_ns = 500.0, latency_nominal_ns = 900.0,
    latency_max_ns = 1500.0, mode = "bounded", submit = "eager"}
%link = classical.get_link {device = 0 : i64} : !classical.link
%link1, %answer = classical.submit %link, @decode(%m0, %m1)
    : (!pulse.measurement, !pulse.measurement)
    -> (!classical.link, !classical.future)
%fix = classical.wait %answer, @decode : i1

Operations#

classical.callable (::classical::CallableOp)#

Declare a classical function the program calls at runtime

Syntax:

operation ::= `classical.callable` $sym_name attr-dict

The schema and timing of one classical function.

  • dispatch_key: the 32-bit FNV-1a hash of sym_name, which identifies the function on the wire. With dispatch_key_override it may be any 32-bit value instead.

  • device: the id of the link the requests travel on.

  • args, results: one type descriptor per argument and result, in wire order: u8, i32, i64, f32, f64; bits:N (N measurements, sent as outcome != 0, bit-packed LSB-first); levels:N (N measurement outcomes, one byte each); iq:N (the IQ points of N readouts, as 2N float32 values, I then Q); and arrays u8[N], i32[N], f32[N], f64[N]. At most 8 arguments and 4 results. A result bits:N gives N i1 values, levels:N gives N i64s, iq:N gives 2N f64s, an array gives its elements, and a scalar one value.

  • latency_min_ns, latency_nominal_ns, latency_max_ns: how long the answer takes, from the end of the submission until it is back. Scheduling budgets latency_max_ns.

  • mode: "bounded" (the answer is assumed back within the maximum), "timeout" (wait gives a leading i1 that is false when no answer came within timeout_ns, which is what scheduling then budgets), or "blocking" (the program stops until the answer arrives; the wait starts a new timing segment).

  • submit: "eager" (sent as soon as its arguments are known, under every scheduling policy) or "lazy" (placed by the policy like any timed op).

  • deadline_ns (optional): the answer must be back within this long of the start of the submission; pulse-classical-check rejects a schedule that cannot meet it.

  • reaction_deadline_ns (optional): in every execution of a call, the answer must be due within this long of the end of the latest readout whose outcome the request carries, or of the start of the submission when it carries none; pulse-classical-check rejects a schedule where it is not.

Interfaces: Symbol

Attributes:#

AttributeMLIR TypeDescription
sym_name::mlir::StringAttrstring attribute
dispatch_key::mlir::IntegerAttr64-bit signless integer attribute
device::mlir::IntegerAttr64-bit signless integer attribute
args::mlir::ArrayAttrstring array attribute
results::mlir::ArrayAttrstring array attribute
latency_min_ns::mlir::FloatAttr64-bit float attribute
latency_nominal_ns::mlir::FloatAttr64-bit float attribute
latency_max_ns::mlir::FloatAttr64-bit float attribute
mode::mlir::StringAttrstring attribute
submit::mlir::StringAttrstring attribute
timeout_ns::mlir::FloatAttr64-bit float attribute
deadline_ns::mlir::FloatAttr64-bit float attribute
dispatch_key_override::mlir::UnitAttrunit attribute
reaction_deadline_ns::mlir::FloatAttr64-bit float attribute

classical.submit (::classical::SubmitOp)#

Send a request to a classical function

Syntax:

operation ::= `classical.submit` $link `,` $callee `(` $args `)` `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles) attr-dict `:` functional-type($args, results)

Sends the request for callee on link, with args in the order the function’s argument descriptors take them: one SSA value per scalar or array element, and one !pulse.measurement per measurement of a bits, levels or iq argument. The submission cannot start before its arguments are available, and it holds the link for the time the request takes to send. It returns the link and a future that becomes available when the answer is due.

Interfaces: SymbolUserOpInterface

Attributes:#

AttributeMLIR TypeDescription
callee::mlir::FlatSymbolRefAttrflat symbol reference attribute

Operands:#

Operand

Description

link

The request channel to one classical device

args

variadic of any type

Results:#

Result

Description

updated_link

The request channel to one classical device

future

A request whose answer is still on its way

classical.wait (::classical::WaitOp)#

Take the answer to a request

Syntax:

operation ::= `classical.wait` $future `,` $callee `` custom<Timing>("getOperationName()", $start_cycles, $duration_cycles, $period_cycles, $timeout_ns) attr-dict `:` type($values)

The values callee returned for the request future stands for. They are available when the future is: the end of the submission plus the budgeted latency (and the link’s feedback latency). Pulses whose parameters, tones or branch conditions are computed from them start no earlier. Scheduling records that time as start_cycles.

With timeout_ns (or when the function’s mode is "timeout") the wait gives a leading i1, false when no answer came within the timeout; scheduling then budgets the timeout instead of the maximum latency.

Interfaces: SymbolUserOpInterface

Attributes:#

AttributeMLIR TypeDescription
callee::mlir::FlatSymbolRefAttrflat symbol reference attribute
timeout_ns::mlir::FloatAttr64-bit float attribute

Operands:#

Operand

Description

future

A request whose answer is still on its way

Results:#

Result

Description

values

variadic of any type

Types#

FutureType#

A request whose answer is still on its way

Syntax: !classical.future

What classical.submit returns. It becomes available when the answer is due, and classical.wait consumes it at most once. A future that is never waited on is a call whose answer the program does not use.

LinkType#

The request channel to one classical device

Syntax: !classical.link

A linear value, like a line: classical.submit consumes it and returns the next version, so the requests on one device are ordered as the program submits them. A link starts at time 0.