qat.middleend.passes.legacy.validation module
- class FrequencyValidation(model, target_data)
Bases:
ValidationPass
This validation pass checks two things:
Frequency shifts do not move the frequency of a pulse channel outside of its allowed range.
Frequency shifts do not occur on pulse channels that have a fixed IF, or share a physical channel with a pulse channel that has a fixed IF.
Instantiate the pass with a hardware model.
- Parameters:
model¶ (
QuantumHardwareModel
) – The hardware model.target_data¶ (
TargetData
) – Target-related information.
- run(ir, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The list of instructions stored in anInstructionBuilder
.
- static validate_frequency_ranges(targets, freqshifts, freq_limits)
Validates that a pulse channel remains within its allowed frequency range.
- Parameters:
targets¶ (
List
[PulseChannel
]) – List of pulse channels to validate.freqshifts¶ (
List
[FrequencyShift
]) – List of frequency shift instructions.
- validate_no_freqshifts_on_fixed_if(targets)
Validates that frequency shifts do not occur on pulse channels with fixed IFs.
- Parameters:
targets¶ (
List
[PulseChannel
]) – List of pulse channels to validate.
- class HardwareConfigValidity(hardware_model)
Bases:
ValidationPass
Validates the
CompilerConfig
against the hardware model.Instantiate the pass with a hardware model.
- Parameters:
hardware_model¶ (
QuantumHardwareModel
) – The hardware model.
- class InstructionValidation(target_data, pulse_duration_limits=None, *args, **kwargs)
Bases:
ValidationPass
Validates instructions against the hardware.
Extracted from
qat.purr.compiler.execution.QuantumExecutionEngine.validate
.- Parameters:
target_data¶ (
TargetData
) – Target-related information.pulse_duration_limits¶ (
Optional
[bool
]) – Whether to check the pulse duration limits. If None, uses the default from the QatConfig.instruction_memory_size¶ – The maximum number of instructions that can be run in a single shot. If None, uses the default from QatConfig.
- run(ir, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The list of instructions stored in anInstructionBuilder
.
- class PhysicalChannelAmplitudeValidation
Bases:
ValidationPass
Validates that the total amplitude of pulses on a physical channel does not exceed allowed levels.
Data is stored in a nested dict structure
{ 'CH1': { CH1.Q0.drive: 0.2+0.5j, CH1.Q0.Q1.cross_resonsance: 0.4+0.0j, }, 'CH2': { CH2.R0.measure: 0.9-0.6j }, }
This pass requires all
Pulse
s to have been lowered to eitherPulseShapeType.SQUARE
or aCustomPulse
with the evaluated pulse samples. Any non lowered pulses with other types may cause the pipeline to fail.- run(ir, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The intermediate representation (IR)InstructionBuilder
.- Raises:
ValueError – for
Pulse
of nonPulseShapeType.SQUARE
type.
- class QiskitResultsFormatValidation
Bases:
ValidationPass
Validates the results format contains BinaryCount, and throws a warning if not.
- run(ir, *args, compiler_config, **kwargs)
- Parameters:
ir¶ (
QiskitBuilder
) – The Qiskit instruction builder.compiler_config¶ (
CompilerConfig
) – The compiler config contains the results format.
- Returns:
The instruction builder, unaltered.
- class ReadoutValidation(hardware, no_mid_circuit_measurement=None, *args, **kwargs)
Bases:
ValidationPass
Validates that there are no mid-circuit measurements, and that the post-processing instructions do not have an invalid sequence.
Extracted from
qat.purr.backends.live.LiveDeviceEngine.validate()
.- Parameters:
hardware¶ (
QuantumHardwareModel
) – The hardware model is needed to check for mid-circuit measurments.no_mid_circuit_measurement¶ (
Optional
[bool
]) – Whether mid-circuit measurements are allowed. If None, uses the default from the QatConfig.
- run(ir, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The list of instructions stored in anInstructionBuilder
.
- class RepeatSanitisationValidation
Bases:
ValidationPass
Checks if the builder has a
Repeat
instruction and warns if none exists.- run(ir, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The list of instructions stored in anInstructionBuilder
.
- class ReturnSanitisationValidation
Bases:
ValidationPass
Validates that the IR has a
Return
instruction.- run(ir, *args, **kwargs)
- Parameters:
ir¶ (
InstructionBuilder
) – The list of instructions stored in anInstructionBuilder
.