qat.pipelines.purr.sweep.compile module

class CompileSweepPipeline(base_pipeline, preprocessing_pipeline=None)

Bases: AbstractPipeline

A pipeline that shims support for compiling instruction builders with sweeps and devices assigns by making repeated calls to an underlying pipeline.

The underlying pipeline must be updateable. This is done because applying device assigns can change properties of the hardware model, and the pipeline must be rebuilt to ensure it is not invalidated. Furthermore, even if device assigns aren’t used, sweeps are often done side-by-side with changes to the hardware model, so it is useful to ensure its rebuilt as a precaution.

Eventually the risks associated with device assigns can be mitigated by mapping device assigns onto instructions in the IR, where possible. For example, a device assign that changes the frequency of a channel can be mapped onto a frequency set instruction. Similar behaviour could implemented for pulse channel scales too, with an e.g. “set scale” instruction, or appropriate mapping onto pulse amplitudes.

Parameters:
  • base_pipeline (UpdateablePipeline) – The underlying pipeline that is used to compile each instance of the sweep.

  • preprocessing_pipeline (Optional[PassManager]) – An optional preprocessing pipeline that runs on the IR before sweeps are flattened out.

compile(program, compiler_config=None, **kwargs)

Compile a builder with sweeps and device assigns against the base pipeline.

Parameters:
  • program (str | InstructionBuilder) – The program to compile, which might include an instruction builder with sweeps.

  • compiler_config (Optional[CompilerConfig]) – Optional compiler configuration to use for this compile call. If not provided, the compiler configuration from the pipeline will be used.

Returns:

A batched executable containing all instances of the sweeps, along with the metrics from the final compile call.

is_subtype_of(cls)

Matches a given type against the pipeline.

property model: QuantumHardwareModel
property name: str
property target_data: AbstractTargetData