qat.purr.backends.qblox.codegen module

class AllocationManager(_reg_pool=<factory>, _lbl_counters=<factory>, registers=<factory>, labels=<factory>)

Bases: object

label_gen(name)
labels: Dict[str, str]
reg_alloc(name)
Return type:

str

reg_borrow(name)

Short-lived register allocation

reg_free(register)
Return type:

None

registers: Dict[str, str]
class BaseEmitter

Bases: object

allocate(target)
Return type:

Tuple[int, int]

class NewQbloxEmitter

Bases: BaseEmitter, InvokerMixin

build_pass_pipeline(*args, **kwargs)
emit_packages(ir, res_mgr, met_mgr, ignore_empty=True)
Return type:

List[QbloxPackage]

class PreCodegenPass

Bases: AnalysisPass

Precedes code generation. The context-based emitter needs registers pre-allocated for every live variable in program. This pass performs a naive register allocation through a manager object.

run(ir, res_mgr, *args, **kwargs)
class PreCodegenResult(alloc_mgrs=<factory>)

Bases: ResultInfoMixin

alloc_mgrs: Dict[PulseChannel, AllocationManager]
class QbloxCFGWalker(contexts)

Bases: DfsTraversal

enter(block)
exit(block)
class QbloxContext(rw_result, iter_bounds, alloc_mgr=None)

Bases: ABC

clear()
create_package(target, seq_idx, slot_idx)
Return type:

QbloxPackage

delay(inst)
device_update(du_inst)
property duration
property durations
static enter_repeat(inst, contexts)
static enter_sweep(inst, contexts)
static exit_repeat(inst, contexts)
static exit_sweep(inst, contexts)
id()
is_empty()

Masks away yet-to-be-supported second-state, cancellation, and cross cancellation targets This is temporary and criteria will change with more features coming in

ledger(duration, pulse=None)

A helper method to keep track of the durations and phase as the codegen runs.

Every little bit of time is accounted for and a timeline object (in static cases) is also kept up-to-date for debugging and visualisation purposes.

measure_acquire(measure, acquire, target)

Regarding HW thresholding, acquire.rotation is in radians and acquire.threshold is uncorrected. (Exactly as they’ve been computed during measure block construction)

Here at configuration time, we “legalise” these parameters to what Qblox requires:
  • rotation as degrees

  • threshold to be corrected by the integration length

property phase
reset_phase()
shift_frequency(inst, target)
shift_phase(inst)
static synchronize(inst, contexts)

Favours static time padding whenever possible, or else uses SYNC. TODO - Default to SYNC when Qblox supports finer grained SYNC groups

wait_imm(duration)

Waits for duration nanoseconds expressed as an immediate.

duration must be positive

wait_reg(duration)

A mere wait RX in general has undefined runtime behaviour.

This is a useful helper to dynamically wait for a duration nanoseconds expressed as a register. iter_reg is a short-lived register only used as an interator. Customer is responsible for (de)allocation.

waveform(waveform, target)
class QbloxEmitter

Bases: BaseEmitter, InvokerMixin

build_pass_pipeline(*args, **kwargs)
emit_packages(ir, res_mgr, met_mgr, ignore_empty=True)
Return type:

Dict[int, List[QbloxPackage]]

class QbloxPackage(pulse_channel_id=None, physical_channel_id=None, instrument_id=None, seq_idx=None, seq_config=<factory>, slot_idx=None, mod_config=<factory>, sequence=None, timeline=None)

Bases: object

instrument_id: Optional[str] = None
mod_config: ModuleConfig
physical_channel_id: Optional[str] = None
pulse_channel_id: Optional[str] = None
seq_config: SequencerConfig
seq_idx: Optional[int] = None
sequence: Optional[Sequence] = None
slot_idx: Optional[int] = None
timeline: Optional[ndarray] = None