‘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 ofsym_name, which identifies the function on the wire. Withdispatch_key_overrideit 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(Nmeasurements, sent asoutcome != 0, bit-packed LSB-first);levels:N(Nmeasurement outcomes, one byte each);iq:N(the IQ points ofNreadouts, as2Nfloat32 values, I then Q); and arraysu8[N],i32[N],f32[N],f64[N]. At most 8 arguments and 4 results. A resultbits:NgivesNi1values,levels:NgivesNi64s,iq:Ngives2Nf64s, 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 budgetslatency_max_ns.mode:"bounded"(the answer is assumed back within the maximum),"timeout"(wait gives a leadingi1that is false when no answer came withintimeout_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-checkrejects 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-checkrejects a schedule where it is not.
Interfaces: Symbol
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
sym_name | ::mlir::StringAttr | string attribute |
dispatch_key | ::mlir::IntegerAttr | 64-bit signless integer attribute |
device | ::mlir::IntegerAttr | 64-bit signless integer attribute |
args | ::mlir::ArrayAttr | string array attribute |
results | ::mlir::ArrayAttr | string array attribute |
latency_min_ns | ::mlir::FloatAttr | 64-bit float attribute |
latency_nominal_ns | ::mlir::FloatAttr | 64-bit float attribute |
latency_max_ns | ::mlir::FloatAttr | 64-bit float attribute |
mode | ::mlir::StringAttr | string attribute |
submit | ::mlir::StringAttr | string attribute |
timeout_ns | ::mlir::FloatAttr | 64-bit float attribute |
deadline_ns | ::mlir::FloatAttr | 64-bit float attribute |
dispatch_key_override | ::mlir::UnitAttr | unit attribute |
reaction_deadline_ns | ::mlir::FloatAttr | 64-bit float attribute |
classical.get_link (::classical::GetLinkOp)#
The link to one classical device
Syntax:
operation ::= `classical.get_link` attr-dict `:` qualified(type($link))
The link of device device, at time 0. Like a line, it is a linear
value that each classical.submit consumes and returns.
Attributes:#
| Attribute | MLIR Type | Description |
|---|---|---|
device | ::mlir::IntegerAttr | 64-bit signless integer attribute |
Results:#
Result |
Description |
|---|---|
|
The request channel to one classical device |
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:#
| Attribute | MLIR Type | Description |
|---|---|---|
callee | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
Operands:#
Operand |
Description |
|---|---|
|
The request channel to one classical device |
|
variadic of any type |
Results:#
Result |
Description |
|---|---|
|
The request channel to one classical device |
|
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:#
| Attribute | MLIR Type | Description |
|---|---|---|
callee | ::mlir::FlatSymbolRefAttr | flat symbol reference attribute |
timeout_ns | ::mlir::FloatAttr | 64-bit float attribute |
Operands:#
Operand |
Description |
|---|---|
|
A request whose answer is still on its way |
Results:#
Result |
Description |
|---|---|
|
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.