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

class ApplyGranularitySanitisation(constraints)

Bases: ModulePass

Apply granularity sanitisation.

apply(ctx, op)
Return type:

None

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

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 constraints.

Parameters:

constraints (PulseLevelConstraints) – Pulse level constraints containing the granularity.

match_and_rewrite(op: Operation, rewriter: PatternRewriter) None

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

Return type:

None