qat.experimental.dialect.pulse.transforms.granularity_sanitisation module

class ApplyGranularitySanitisation(granularity)

Bases: ModulePass

Apply granularity sanitisation.

Initialises the pass with a positive granularity.

Parameters:

granularity (TimeAttr) – Granularity used for sanitisation.

apply(ctx, op)
Return type:

None

name: ClassVar[str] = 'apply-granularity-sanitisation'
class GranularitySanitisation(granularity)

Bases: RewritePattern

Rounds the durations of quantum instructions so they are multiples of the clock cycle.

This pattern ensures that ConstantOps with TimeType are rounded up to the nearest multiple of the specified granularity. ConstantOps with WaveformType are rounded up to the nearest multiple of the specified granularity. If a waveform duration is rounded up, the waveform is padded with zeros to ensure that the new duration is a multiple of the granularity.

Warning

This pass has the potential to invalidate the timings for sequences of instructions that are time-sensitive.

Initializes the pattern with the given granularity.

Parameters:

granularity (float) – Granularity in seconds.

match_and_rewrite(op: Operation, rewriter: PatternRewriter) None

Match an operation, and optionally perform a rewrite using the rewriter.

Return type:

None