The Program a Backend Reads#
This page covers the program that ScheduledKernel.export_to_controller()
gives a controller backend: every key, event and run-time expression of its
two formats. It is for people who write the software that turns that
program into a controller’s own instructions.
This page describes the program as plain data, which is how a backend reads
it today; it will change when the scheduled program can be read through a
typed walk.
On this page a tone’s state is its frequency and phase, and a tone change
is a phase or frequency change of a tone: shift_phase, set_phase,
shift_frequency or set_frequency.
Exporting a program#
ScheduledKernel.export_to_controller() returns a compiled kernel as JSON-serializable
data. Its format is "cudaq-pulse.controller/1"
(cudaq_pulse.controller.FORMAT): the schema’s name and, after the slash,
its major version. Within one version keys and event kinds may be added, but
none is removed or changes meaning, so a backend ignores keys it does not
know and refuses event kinds it does not know; a change that would break a
backend gets a new version.
At the top level, quantum_system and clock_ghz name the quantum system and its
clock, schedule the schedule policy, qudits the quantum system qudits the
program uses, lines each line’s index, role ("drive" or
"readout") and qudit (and, with line delays, its fine_delay_ns;
see below; on a shared line, the line’s qudits and
max_concurrent_tones; see Shared lines), and limits the controller limits it was
checked against (null without). Each line also has
native_frequency_hz, the frequency of its own tone (line.tone):
on a drive line the frequency the qudit’s 0-1 drive tone plays at, and on
a readout line its readout’s frequency_hz, or that same drive
frequency when the readout states none. Every shot
starts that tone at this frequency, and its phase_rad advances
from it when the tone is retuned, so a backend that plays a line’s other
frequencies (another transition’s tone, a shifted frequency) as offsets
from one oscillator needs nothing from the quantum system.
The frequency a drive tone plays at is the qudit’s
dressed_frequency_hz: its 0-1 frequency with the system’s couplings
included. On a system without couplings that is the qudit’s
frequency_hz. On a system with couplings it is not: the couplings
shift each qudit’s 0-1 transition, the tones play at the shifted
frequency, and frequency_hz stays the bare value the Hamiltonian
uses. Two qudits at 5.0 GHz and 5.15 GHz coupled with 3 MHz:
# qudit 0: frequency_hz 5000000000.0, dressed_frequency_hz 4999940023.980819
# qudit 1: frequency_hz 5150000000.0, dressed_frequency_hz 5150059976.019181
"lines": [
{"line": 0, "role": "drive", "qudit": 0, "native_frequency_hz": 4999940023.980819},
{"line": 1, "role": "readout", "qudit": 0, "native_frequency_hz": 4999940023.980819},
{"line": 2, "role": "drive", "qudit": 1, "native_frequency_hz": 5150059976.019181}
]
A drive on line 0 has frequency_hz 4999940023.980819, and the readout
line, whose readout states no frequency, starts there too. A system made
with frames="bare" plays its drive tones at frequency_hz instead:
the same export then gives 5000000000.0 and 5150000000.0, and
dressed_frequency_hz gives those values as well, since it is the
frequency the tone plays at. A backend should take a line’s frequency
from native_frequency_hz and never from the qudit’s frequency_hz.
On a system
that does not state its frequencies they are offsets:
quantum_system.frequency_frame is "shared_reference" when every
frequency_hz and native_frequency_hz is an offset from one reference
the qudits share, and "own_carrier" when each line’s native frequency
is 0 and its events’ frequencies are offsets from its own qudit’s carrier
(see Describe a Quantum System); the export’s keys are the same. A kernel with
qudit parameters gives it as the slot’s symbols instead (s0.f01,
s0.f_ro; see below) and its lines leave it out. events lists every drive, readout,
wait, sync, classical call and frame_update event (a tone change that
no later pulse takes) in program order, once per loop
iteration and both arms of a branch. segments, calls, links and
manifest are those of ScheduledKernel.export_to_emulator() (see
Call Classical Code During a Shot).
A kernel with list or qudit parameters compiles once for every call, and
its export says what each call binds: program_id is the same for every
call of that compile, and symbols lists the call’s values, each with
its symbol, kind and value: a float parameter or element
("float"), a runtime qudit’s slot ("slot", s0, the carrier
bound), and the native frequencies of the slot’s lines ("frequency"):
s0.f01, the frequency its 0-1 drive tone plays at (its
dressed_frequency_hz, as above), for a drive line, and s0.f_ro, the
frequency_hz of its readout (else that drive frequency), for a readout
line. Each event names in its symbols the slot of its line
(qudit) and, by field (frequency_hz, phase_rad,
waveform), the symbols its value depends on; a tone on a slot’s line
depends on that line’s native frequency. Each event has:
index,kindIts position in
eventsand one of"drive","readout","wait","sync","submit","answer"and"frame_update".line,quditThe line it plays on and that line’s qudit;
nullfor a sync. For a classical call,lineis its link andquditis -1.tone_slotOnly on a drive, readout, wait or
frame_updateevent on a shared line (see Shared lines): the line’s tone it plays, as in/2.start_cycles,duration_cycles,end_cyclesThe final schedule as integers, in clock cycles. A backend places every event at its start and does not schedule again.
iterationThe iteration of each loop around it, outermost first.
segmentThe segment it starts in. A wait whose length is an answer, and a blocking wait for an answer, end one segment of the lines that wait for it and start the next; an event shifts by the run-time lengths of its segment’s barrier and of the barriers of the segments it follows. Each segment follows the one before it, or the segment its
afternames.conditionsThe measurement-conditioned branches the event lies in, outermost first: the
branch, thearm(truefor theifarm), and thereadoutsandanswers(event indices) the condition is computed from.testis"is_set"when the condition is whether one readout is set,"answer"when it is one answer value, else"expression", and thenexpressionis the condition, a bool expression (see Run-time expressions) over those readouts and answers. A condition withtest"answer"also hasresult, which result of that answer it is, numbered as in an expression’s{"answer": i, "result": k}: for a call with a timeout, result 0 is the flag that the answer came in time and resultk + 1the function’s valuek. The event plays when every condition is itsarm. Events in the two arms of one branch may overlap in time; only one arm plays.
Drives and readouts also have:
waveform,amplitudeThe waveform’s expression,
{"shape": "gaussian", "params": {"duration": ..., "amplitude": ..., "sigma": ...}}, withscale,neg,add,subandmulnodes overof, andsamplesforcustom_samples(whichcustom()envelopes become when the kernel is traced), at the line’s own rate (its controller’ssample_rate_ghz); and its overall complex amplitude,{"re": ..., "im": ...}. Times in parameters are in cycles.samplesWith
export_to_controller(sample_rate_ghz=...), a whole multiple of the clock, the envelope sampled at that rate,{"re": [...], "im": [...]}.cudaq_pulse.controller.sample_waveformcomputes the same samples for one waveform. Samplekof a shape (gaussian,drag, …) is its envelope at the start of that sample,ksamples from the pulse’s start, as the simulator plays it; acustom()envelope was sampled at the middle of each sample when the kernel was traced, andcustom_samplesare played as given. An instrument that evaluates a shape at the middle of each sample plays these samples with the shape delayed by half a sample.frequency_hz,phase_radThe tone’s frequency and its phase as the event starts, with every tone change and virtual Z before it applied and the phase a detuned tone gains over time, or
nullwhere the two arms of a branch leave them different or a tone change is known only at run time.tone,frame_updates,phase_offset_radOnly on a tone whose state depends on run time: one with a tone change computed from a readout or an answer, or made in a branch. The tone’s id (such tones are numbered in the order they are first played), and the tone changes on that tone since its previous drive or readout, in program order: each with
id,op("shift_phase","set_phase","shift_frequency"or"set_frequency"),value(a number, or an expression),start_cycles, where it is made on the tone’s timeline (see below), from which the tone gains phase at its new frequency even where the value is known only later, andconditions, the branch arms it is on the path of. One change pending before a branch whose arm plays on the tone is listed again, with the other arm’s condition, at the next drive after the branch; the sameidnames it both times. A controller tracks such a tone’s state itself, applying these instead of readingfrequency_hzandphase_rad, eachidonce. A drive whose own phase offset does not change the tone state hasphase_offset_rad.
A program with such tones has runtime_tones (after events and
frame_state): by each
tone’s id, as a string, its line (a line’s own tone’s line, else the line
it first plays on) and the tone state every shot starts it in,
reset_frequency_hz and reset_phase (in radians), to which a
controller tracking the tone applies its frame_updates. On the line of a
runtime qudit, the entry’s symbols name the symbol its reset frequency
is, s0.f01 on a drive line and s0.f_ro on a readout line. A
program without such tones has no runtime_tones.
Every shot starts from the reset tone state: each tone at its own frequency, with
phase 0. A tone change (shift_phase, set_phase, shift_frequency,
set_frequency) is a point on the timeline: in the scheduled IR it has
start_cycles and a duration_cycles of 0. It is where the program
makes it on its tone’s line: after the waits, pulses and syncs before it
there and after the readouts it depends on (in the arm of a branch on a
measurement, or with a value computed from one); or, on a tone that next
plays on another line earlier, where its previous drive or readout ends. A frequency shifted before a wait and back
after it so runs shifted through the wait, and the drives after it have
the phase gained. The next drive or readout on
its tone takes it in its frequency_hz and phase_rad; in a loop, the
next iteration’s do. In a loop whose iterations do not play its tone, a
change is at the start of each iteration, or, where it depends on
readouts, once they complete. A change written after a wait whose length
is an answer, or after an answer waited for as long as it takes, is no
earlier than the segment that point opens starts, however early its tone
and its line are free: the controller reaches it only then. So the time
from the change to the drive or readout that takes it does not depend on
how long the wait or the answer takes, nor does the phase the tone gains
in it; and the change has the same place whether the loop around it is
kept or written out. A change takes no time: every
drive, readout, wait and loop, and the program, starts and lasts as it does
without it.
The compiler keeps every change the program makes, and where no later
drive or readout takes a change on some path, the export gives that
execution as a "frame_update" event of its own, decided from the
program alone:
A change nothing takes is a
frame_updateevent where it is made, in every iteration of a loop around it; a loop kept rolled stays rolled, theframe_updateevent in its body.A change a loop carries out of its last iteration, which nothing after the loop takes, is a
frame_updateevent after the loop, at its place in the last iteration.A change made before a branch that only one arm takes, in the segment the branch is in, is a
frame_updateevent at the start of the other arm (or of the missingelse), with that arm’sconditions; the arm that takes it plays with it as before.When a segment starts between such a change and the branch (an answer waited for as long as it takes, or a wait whose length is an answer, lies between them), the change is a
frame_updateevent where it is made, in its own segment and with noconditions: it happens whichever arm runs, and the arm’s condition is known only in the later segment. A change of a tone’s phase before the answer and a drive in one arm after it are listed as:{"index": 0, "kind": "frame_update", "start_cycles": 0, "segment": 0, "conditions": [], "phase_rad": 0.5, ...} {"index": 5, "kind": "drive", "start_cycles": 824, "segment": 1, "conditions": [{"branch": 0, "arm": true, "answers": [3], ...}], "phase_rad": 0.5, ...}
A change a loop’s last iteration leaves to such an arm is one
frame_updateevent after the loop, at its place and in its segment in the last iteration, the loop kept rolled or written out.A change a loop carries through a branch, or out of a loop whose iterations do not play its tone, is a
frame_updateevent at every execution; a drive or readout that takes it on another path has it in its tone state as well.
A frame_update event has op and value, as in frame_updates, its
start_cycles (its place) and a duration_cycles of 0, and the tone’s
frequency_hz and phase_rad with the change applied; on a tone whose
state depends on run time, tone and the frame_updates it applies,
as a drive has. A controller tracking that tone state applies the event’s
frame_updates, each id once, as it does a drive’s; the last of them
is the event’s own change, which its op and value restate, so it is
not applied again. Its line is its tone’s, else the line the tone last
played on, else null. A controller whose tone states persist from one shot to the next
declares Controller(persistent_frames=True); such changes then
have no event, and the program’s frame_state (after events) gives
the state each tone ends the shot in, by line: its line, and its
frequency_hz and phase_rad at the end of the shot, or, for a tone
whose state depends on run time, its tone and the frame_updates not
yet taken.
A waveform parameter computed from a readout or an answer is null in
params and has an expression (see Run-time expressions) in the
node’s runtime, by parameter name. A variable
wait’s duration_cycles is its least length, and it also has length,
the expression of its length in cycles, and min_cycles and
max_cycles, its bounds. A program that computes nothing from its
readouts and answers exports none of these keys.
A sync has lines, the lines it joins, and lasts 0 cycles: no event on
those lines before it ends after its start, and none after it starts
before. Its start is never before the start of its segment: a sync after an
answer its lines waited for is listed where that answer’s segment starts.
A classical call is a submit, while the request holds its link, and an
answer, when the answer is taken. Both have link and function;
a submit has measurements, the readout events whose outcomes it sends,
and operands, its arguments in the order of the function’s argument
descriptors (one per scalar or element, and one {"readout": i} per
measurement), each an expression; an answer has wait,
"bounded" (by the latency budget), "blocking" or "timeout",
with timeout_ns. A call taken with result(timeout=...) waits
with that timeout, and one of a function declared with
latency_mode="timeout" (and taken without one) with the function’s
timeout_ns.
The events of one operation, and of operations with the same waveform,
share their waveform and amplitude objects; copy one before
changing it.
Run-time expressions#
What a program computes from its readouts and answers (a run-time waveform
parameter, a wait’s length, a frame_update event’s value, a submit’s
operands, a branch’s expression) is an expression in a closed
vocabulary of terms, whatever operations the compiler computes it with:
y = x if x > 0.1 (else 0.1) and y = x if 0.1 < x are both
max. An expression is one of:
{"const": x}A number, or
trueorfalse.{"readout": i}The level the readout event
iobserved, an integer; 0 is the ground state, and the outcome is set for any other level.{"answer": i, "result": k}Result
kof the answer eventi: a float for afloatresult, an integer for anintone, a bool for a bit. A call taken withresult(timeout=...), or of a function declared withlatency_mode="timeout", has the bool that its answer came in time as result 0, before the function’s values.{"op": term, "type": t, "of": [...]}A term over the expressions in
of, computed in the typetof its operands,"int","float"or"bool". Aconstin a float term is that float, so{"const": 3}there is 3.0.{"term": n}Term
nof the expression’sterms, where that term is used.
An expression that is a term may have "terms": [...] beside its
op, type and of: terms written once there and used by their
place in the list, the first being term 0. A term is in terms when
the expression uses it more than once, or when the expression would
otherwise nest more than 65 terms deep; every other term is written where
it is used. A term of terms uses only terms before it, so computing
the list in order computes each term once. For t = x * 0.001 (x
result 0 of answer event 1), t = t + t and a phase shift of t + t:
{"terms": [
{"op": "mul", "type": "float", "of": [{"answer": 1, "result": 0}, {"const": 0.001}]},
{"op": "add", "type": "float", "of": [{"term": 0}, {"term": 0}]}],
"op": "add", "type": "float", "of": [{"term": 1}, {"term": 1}]}
terms is only at the root of an expression and belongs to all of it;
code that makes an expression an operand of a new term moves the list to
the new root. The compiler writes no expression that nests more than 65
terms deep, however many terms the program computes it with, which is the
deepest it wrote one before there were terms; the length of a wait on
a controller with a clock of its own is up to three terms more (its
bounds, and the conversion to the controller’s cycles), as before. An
expression has no terms unless it uses a term more than once or is
deeper than that: an export that held no such expression is written as
before.
cudaq_pulse.controller.ExpressionTerm names every term. A value
computed any other way is an UnsupportedError when the program is
exported, never a term a backend has to guess at;
cudaq_pulse.controller.evaluate_expression(expression, readouts,
answers) computes an expression as the controller must, which is the
reference for a backend’s own evaluation. Integers are 64-bit two’s
complement and floats IEEE 754 binary64, rounded to nearest, ties to even.
add,sub,mula + b,a - banda * b. Integers wrap modulo 2 to the power 64; floats overflow to ±inf.diva / b. An integer quotient is truncated toward zero; a float divided by zero is ±inf, and 0 / 0 is NaN.floor_div,remIntegers only: the quotient rounded toward −inf, and the remainder
a - b * div(a, b), which has the sign ofa. An integerdiv,floor_divorremby 0, or of −2 to the power 63 by −1, has no value, and the controller fails the run.neg-a. The integer −2 to the power 63 wraps to itself; a float changes sign, 0 and NaN too.max,minmax(a, b)isawhena > b, elseb, andmin(a, b)isawhena < b, elseb. For integers that is the usual maximum and minimum, which the export writes with the operands of the comparison it comes from. For floats the order is part of the value, as the kernel’s comparison was:max(NaN, 1)is 1 andmax(1, NaN)NaN,max(-0.0, 0.0)is 0.0 andmax(0.0, -0.0)−0.0.eq,ne,lt,le,gt,geA bool:
a == b,a != b,a < b,a <= b,a > b,a >= b. Integers compare signed. Floats compare ordered, so every comparison with a NaN is false butne, which is true. Bools have onlyeqandne.selectofis[c, a, b]:awhen the boolcis true, elseb;typeis the type ofaandb.to_floatThe integer
aas the nearest float (type"int").to_intThe float
atruncated toward zero (type"float"); NaN, ±inf and floats outside the 64-bit integers have no value, and the controller fails the run.controller_cyclesA length of
aprogram cycles in the controller’s cycles,a * num / den, withnum,denandtimestepbesideof(see Clocks); the controller fails the run whenais not a whole number of timesteps.
A frontend computes an integer answer used as a time in floats, so
wait(d, n + 4) is to_int(add(add(to_float(n), 4), 0.5)). Whether
a readout is set is ne(readout, 0), and a bool used as an integer a
select of 1 (or −1) and 0. A comparison has its constant second:
3 < n is gt(n, 3). Bools combine without terms of their own:
a and b is select(a, b, false), a or b is select(a, true,
b), a != b (exclusive or) is ne(a, b), and not a is
ne(a, true), except that not of an integer comparison is the
opposite comparison (not (n <= 3) is gt(n, 3)) and of eq or
ne the other; a float not (x <= 0.1) stays as it is, since it holds
of NaN and x > 0.1 does not. There is no JSON schema; this section and
evaluate_expression define the expressions.
The structured format#
export_to_controller(version=2) gives format
"cudaq-pulse.controller/2", which grows with a program’s operations
rather than with its executions, as a sequencer runs it. It is written for a
controller on the program clock, in timesteps of any
length; for one on its own clock, or with line delays, export
/1. It has the keys of /1, except that:
eventsEach event’s
kindis one ofcudaq_pulse.Event, named for what a controller does whatever the modality:"play"(a/1drive),"readout"(a/1readout),"wait","sync","loop","call"(a/1submit),"answer"and"frame_update". An event in a branch keeps its kind and lists itsconditions, and phase and frequency changes are in thetonesof the events that play them; a change no event plays is a"frame_update", with its tone state intones. A backend refuses a kind it does not know.A tree. A loop whose iterations repeat (each event moves by one period, and every tone keeps its frequency) is one
loopevent:tripsiterations fromfirst_iteration(omitted when 0), oneperiod_cyclesapart, itsstart_cyclesandduration_cyclesspanning them, and itsbody, the events of its first iteration. An event in the body of loops startsstart_cyclesplus, for each loop around it, the iterations since its first times its period. A first iteration that differs from the rest is exported before its loop; a loop that does not repeat is exported once per iteration, as in/1.waveformsEach distinct waveform expression once; a play or readout gives the index of its own in
waveform. Withsample_rate_ghz,samplesholds each one’s samples, in the same order. Each also hasid, 16 hex digits that depend on its expression alone, so they stay the same from one compile, call, line or controller to the next, andshape_id, equal for waveforms that differ only in overall amplitude and phase (shape_key), the ones a controller that scales what it plays stores once.parametersFor a module with
floatparameters, each one’svaluein this call and what itreaches:"amplitude"(an overall factor of a waveform),"phase","frequency","shape"(another waveform parameter),"timing"(a length) or"other". A parameter that reaches only amplitudes and phases leaves everyshape_idthe same for every value. Omitted without parameters.controllerIn place of
limits: the controller, its fields under the nameslimitsgives them. What it computes is inprocessors, always listed (empty for a controller without processors), each one asProcessor.as_dict()gives it:links,clock_ghz,cycles_per_op(the cost of each class of operation it computes),unsupported(the classes it cannot compute, by name),max_concurrent_calls,max_ops_per_function,max_ops_total,max_state_bytes_per_function,max_state_bytes_total,max_calls_per_shot,max_bytes_per_shot,fixed_cost_onlyanddispatch_keys.quantum_systemIn place of
quantum_system: the name of the quantum system the program is for.sample_rate_ghzBeside
clock_ghz, always a number: the rate at which the controller’s converters play waveform samples, so that the program states its own timing. A waveform ofnsamples lastsn * clock_ghz / sample_rate_ghzcycles. The ratio may be fractional (2.4 GHz on a 1 GHz clock), but every waveform lasts a whole number of samples, and the export raisesValueErrorfor one that does not rather than round. The rate is the controller’s, else the export’ssample_rate_ghz, which must then be the same, elseclock_ghz(one sample per cycle). Unlike in/1, it need not be a whole multiple of the clock, andsamplesare present only when the export is givensample_rate_ghz.linksEach link with
send_ns,bandwidth_bytes_per_ns,answer_delay_nsandslotsforLink.fixed_ns,bytes_per_ns,feedback_nsandslots.linesEach line’s
qudits, a list, in the order the program first uses the lines. A shared line (see Shared lines) is listed once, with every qudit it reaches and itsmax_concurrent_tones, which a dedicated line does not have. In place ofnative_frequency_hz,native_frequencies_hz: the native frequency of each of itsqudits, in the same order.- Events on a shared line
A play, readout, wait or
frame_updateevent on a shared line has, after itsline, itstone_slot(0 to the line’smax_concurrent_tonesminus 1: the tone it plays, which a controller maps to one of the line’s oscillators) andqudits, the one qudit it is for. Tones that play at the same time have different slots. Slots are given from the program alone, so every export of it gives the same: a line playing one tone at once gives every event slot 0; else each qudit keeps one slot for the whole program when the line has enough for the qudits whose events overlap (lowest free slot first, in the order of their first events); else each tone takes the lowest free slot in start order, which a rolled loop cannot hold (UnsupportedError: unroll it, or give the line more tones). A sync lists each of its lines once;runtime_tonesandframe_stateentries name the line and, on a shared line, thequdits(andtone_slot) of their tone. On dedicated lines none of these keys are present, and a program that plays no shared line exports as it does on a system without them.- Broadcast lines
A broadcast drive line (see Broadcast lines) is listed once, with
"broadcast": true, every qudit it reaches, and onenative_frequency_hz, its tone’s, in place ofnative_frequencies_hz. A play orframe_updateevent on it has, after itsline, the line’squdits, all of which it reaches, and notone_slot; so do itsruntime_tonesandframe_stateentries.- Played events and
frame_updateevents tones, a list of the tones the event plays (aframe_updateevent’s tone state), each with itsfrequency_hz, itsphase_radin the loops’ first iterations, andphase_step_rad, the phase added per iteration of each loop around it, outermost first.- Segments in a rolled loop
An event’s
segmentis that of the loops’ first iterations; in a loop whose body ends segments (a blocking wait for an answer, or a wait whose length is an answer),segment_stepis the segments added per iteration of each loop around it, outermost first, omitted where every step is 0.- Values known at run time
As in
/1, and only where a value is computed from a readout or an answer:tone,frame_updatesandphase_offset_radon a play or readout,length,min_cyclesandmax_cycleson a wait, andoperandson a call; an expression’sreadoutandanswerare places, like other references, and resolve to the latest execution of that place before the event, so a rolled body refers to its own events, and a tone change’sstart_cyclesis given as an event’s is. A waveform parameter known only at run time is its expression in the entry of the program’swaveformsthe event plays, where/1hasnulland the node’sruntime. The program’sruntime_tonesandframe_stateare as in/1. A loop whose body changes or plays a tone whose state is tracked at run time is exported once per iteration, so that each tone change keeps its ownid; a loop whose run-time values repeat with its iterations stays one loop.- Symbols
A kernel with list or qudit parameters has
program_idandsymbolsas in/1, and each event thesymbolsits fields depend on; an event in a loop’s body names those of any of its iterations.- Left out
What follows from the rest or is the default: an event’s
index(its place in a pre-order walk of the tree, loops included, which is what references give), itsqudit(its line’s), itsend_cycles, an emptyiteration(nullfor a loop kept rolled), asegmentof 0, emptyconditions,readoutsandanswers, thelineof a sync or a classical call, atimeout_nsofnull, and theamplitude, which follows from the waveform. A reference is to the latest execution of the event it names.programs,bindingsReserved for programs that several controllers share and the tables that bind them to each; empty for now.
cudaq_pulse.controller.unroll(program) turns a /2 program into the
/1 program of the same kernel, for a backend that needs every
execution; phases agree up to rounding and branches are numbered in the
order they first appear. A /2 program lists a shared line once, so on
one, unroll numbers the lines in the order of the /2 lines, each
shared line’s qudits in its order (those the program plays at), where the
/1 export may number them in the order the kernel takes them, and a
sync names every /1 line of a shared line it joins.
Where to go next#
Write and Validate a Backend shows a backend that reads this program, and how to validate it.
Describe Your Control System describes the controller the program is checked against.
From Kernel to Controller exports a kernel and reads the result, step by step.
Lowering to Your Controller’s Instruction Set lowers an exported program to the instructions of a sequencer.