Part D · Lesson 3

Who drives what

Which core drives which channel is a line in the design. Give the channels of three qubits to one core and the feed-forward program no longer needs the board hub: the measured bit stays inside one processor. That has a price, and this lesson measures both sides.

This lesson assumes lessons D1 and D2, and uses the hub and barriers of lesson B4. Lesson E1 breaks down the feedback latency in detail.

1Allocation is a field

Each channel of a design names its core. Each qubit names its channels by id. Nothing else ties a qubit to a core. When the design becomes a machine, machine() in riscq/design.mjs builds a function locate(qubit, role) that answers "which core and which channel plays this qubit's gate, readout tone, acquisition window or CZ tone?" by following those ids. The superconducting lowering asks locate for every action. So moving a channel to another core moves every action on that channel, and the firmware generator then writes a different program for each core.

In the ring every qubit has its own core. The Bell program of lesson A1 uses qubits 0, 1 and 2, so three cores work. Qubit 0's core measures the bit c; qubit 2's core plays x if c is 1. The bit must cross the hub: q0 publishes it, every core receives it, the cores meet at a barrier, and q2 schedules the conditioned pulse.

2Three qubits on one core

In this section: the edit, the rules it must respect, and what the check reports.

The edit is the one in tests/riscq-design.test.mjs:

for (const channel of design.channels)
  if (["q1", "q2"].includes(channel.core))
    Object.assign(channel, { name: channel.core + "_" + channel.name, core: "q0" });
design.parts = design.parts.filter((part) => !["q1", "q2"].includes(part.id));

Every channel of cores q1 and q2 moves to q0. The channels are renamed (q1_gate, …) because names must be unique on a core; their ids, which the qubits refer to, stay the same. The now empty cores are removed, since a core with no channel breaks a rule. Core q0 then owns 15 channels, one fewer than the limit of 16.

Merge cores into q0

Tick the cores whose channels should move to core q0. Check sends the design to POST /api/riscq/design/check; Run runs the Bell program on it with c = 1 and on the unchanged ring, and compares them.

Merge q1 and q2 into q0 and check the design. How many channels does core q0 have in the build the check returns?

5 + 5 + 5 = 15: each of qubits 0, 1 and 2 brings a gate channel, two CZ channels, a readout tone and an acquisition channel. The build lists them in document order.

Tick q3 as well. The check now fails. How many channels would core q0 have?

20. The message is "Core q0 has 20 channels. A core has 1 to 16." A RISC-Q core addresses 16 channel nodes in its put window (nodes 0 to 15); higher nodes reach the hub.

Converters stay where they are

The merge changes who writes, not what plays. Each moved channel keeps its converter: the gate channel of qubit 1, now q1_gate on core q0, still drives DAC 1, and the wire from DAC 1 to qubit 1 is unchanged. So the pulses, their carriers and their wire delays are the same as before. What changes is the build: core q0's put window now addresses 15 channel nodes, the firmware generator writes one program for q0 that issues every timed write of the three qubits, and cores q1 and q2 no longer exist. The cores q3 to q7 still exist; they have nothing to do in this program and park at once, as in the ring.

A converter and a core are separate parts of a design for this reason. A core is a processor that schedules writes; a converter is where a signal leaves the controller. Several channels on different cores may name the same DAC (the eight readout tones do), and one core may drive channels on many DACs (the merged q0 drives DACs 0, 1, 2 and 8 and reads ADC 12). Which assignment is best depends on what the program needs to share between qubits, which is the subject of the rest of this lesson.

3The bit never leaves the core

Run the merged design. The run is clean: no fault, every pulse on time, the bit c read as 1. Now look at what is missing. Only core q0 issues timed writes. There is no publish frame, no board frame and no barrier arrival anywhere in the trace. When a single core plays every pulse, the compiler needs no barrier to give cores a common time base, and the bit that conditions the x is already in the core's own memory.

Compare the ring. There, the three cores meet at a barrier before the first segment, so that their start times refer to one common batch. After the measurement, q0 stores the bit to the host window, publishes it through the hub, the hub writes it into every core's board register, and the cores meet at a second barrier before q2 issues the conditioned fire. Every one of those steps is a frame in the trace, and every one costs batches. Open the run of the figure below and step from the result frame on q0.inbox to the conditioned pulse on qubit 2 to see them in order.

How many publish frames does the merged run contain?

None. On the ring the measuring core publishes c once, and the hub delivers it to all eight cores 8 batches later. The merged program has nobody to tell.

In the merged run, how many nanoseconds after qubit 0's acquisition window closes does the conditioned x open?

248 ns, against 344 ns across three cores. The result reaches the core 34 ns after the window closes in both. On the ring the bit then needs the hub (to 86 ns at every core) and a barrier before q2 can schedule its fire. On one core the conditioned fire is issued a few batches after the result is read, one 96-batch lead (192 ns) ahead of its start.
The ring as a design, in the Control system view, at the step where q0 publishes c through the hub. The merged design has no such step.

4The price: one core does all the writing

The merged run is faster where it matters for feedback, but it is longer overall. A core issues one posted write at a time. Before the first pulse, every core writes the registers and the pulse table of each of its channels; the merged core does that for 15 channels alone. Over the whole run it issues 152 posted writes, where the three cores of the ring issue 56, 54 and 49 in parallel. Pulses that used to come from three cores on the same batch now come from one, so the preroll of the first segment grows as well, from 7 to 52 batches.

Program memory is not the limit here. The merged core's program is 460 words, where the three separate programs were 187, 172 and 159 words; the build gives each core 8,192 words. On the ion trap of lesson C2 it was the other way round: there a core with 16 electrode channels ran out of RAM before it ran out of channels. Which resource binds first depends on the program, so measure it with a run rather than guess.

How many nanoseconds later does the first pulse of the program open in the merged run than on the ring?

The first window opens at batch 651 instead of 320: 331 batches, 662 ns later. The setup of 15 channels and the wider first burst cost more than the 96 ns the merged design saves on the feedback.

When does it pay to put several qubits on one core?

  1. Always: fewer cores means a faster machine.
  2. Never: the hub is as fast as a core's own memory.
  3. When a measured bit conditions a pulse on another qubit and the feedback latency matters more than setup time and issue rate, within the limit of 16 channels per core.
  4. Only when the qubits share a DAC.
The hub costs tens of nanoseconds and a barrier; a core's issue rate costs time whenever many writes fall together. Error-correction rounds, where syndromes condition corrections, are the case where the first matters. The choice is a design decision, and the design document is where you make it.

What to remember

  1. Which core drives a qubit is the core field of its channels; locate follows it for every action.
  2. A core holds 1 to 16 channels with unique names; empty cores must be removed.
  3. Three qubits on one core: no publish, no barrier, and the conditioned pulse opens 248 ns after the window instead of 344 ns.
  4. The same core then does all setup and issues every burst alone: the program starts 662 ns later.
  5. Allocation trades feedback latency against issue capacity. The run measures both.