qat.experimental.dialect.gate.ir package
The Gate dialect models quantum programs at the gate level.
It is the entry point of the compiler: gate-level programs are optimised, placed (algorithmic qubits mapped to physical qubits) and then lowered to pulses.
- class AlgorithmicQubitType(*parameters)
Bases:
AlgorithmicQubitTypeAn algorithmic qubit type, assigned at circuit construction time.
Represents a qubit as it appears in an algorithm, such as a qubit in a source QASM2 program, with no hardware assignment. Placement maps algorithmic qubits to physical qubits.
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
- name: ClassVar[str] = 'gate.qubit.algorithmic'
The attribute name should be a static field in the attribute classes.
- class AllocateAlgorithmicQubitOp
Bases:
AllocateAlgorithmicQubitOp,AllocateQubitOp,AllocateQubitOp,IRDLOperation,Operation,_IRNode,ABC,objectAllocates a new algorithmic qubit, initialised to the |0⟩ state.
An algorithmic qubit is a qubit as written in the source program, before placement. Compiling a program starts by allocating its qubits with this op.
Allocates an algorithmic qubit.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.allocate_qubit.algorithmic'
The operation name. Should be a static member of the class
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class AllocatePhysicalQubitOp(index)
Bases:
AllocatePhysicalQubitOp,AllocateQubitOp,AllocateQubitOp,IRDLOperation,Operation,_IRNode,ABC,objectAllocates a new physical qubit, initialised to the |0⟩ state.
- Parameters:
index¶ (
IntegerAttr|int) – The index of the qubit on the device.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.allocate_qubit.physical'
The operation name. Should be a static member of the class
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class AllocateQubitOp(qubit_type)
Bases:
AllocateQubitOp,IRDLOperation,Operation,_IRNode,ABC,objectAllocates a new qubit of any qubit type, initialised to the |0⟩ state.
The result type says whether the qubit is algorithmic or physical.
AllocateAlgorithmicQubitOpandAllocatePhysicalQubitOpeach allow only one.- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.allocate_qubit'
The operation name. Should be a static member of the class
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class BarrierOp(qubits)
Bases:
BarrierOp,IRDLOperation,Operation,_IRNode,ABC,objectOptimisation barrier across a set of qubits.
Stops optimisations moving operations on these qubits across the barrier. It carries no timing: whether it also lines up the qubits’ timelines is decided when it is lowered. Takes a variadic set of distinct qubits and returns each one unchanged.
- Variables:
qubits – Qubits operand to which the barrier is applied.
result_qubits – The qubits after the barrier.
- Parameters:
qubits¶ (
Sequence[SSAValue|Operation]) – The qubits to fence. Each result has the type of its qubit.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.barrier'
The operation name. Should be a static member of the class
- qubits
Access a variadic construct in the case where it is the only variadic.
- result_qubits
Access a variadic construct in the case where it is the only variadic.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class CXOp(control, target)
Bases:
CXOp,CliffordDirectionalTwoQubitGate,DirectionalTwoQubitGate,TwoQubitGate,IRDLOperation,Operation,_IRNode,ABC,objectThe controlled-X (CNOT) gate.
Builds the gate. Each result has the type of its qubit.
- Parameters:
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.cx'
The operation name. Should be a static member of the class
- qubit_0
Access a non-variadic construct which appears before any variadic arguments.
- qubit_1
Access a non-variadic construct which appears before any variadic arguments.
- result_qubit_0
Access a non-variadic construct which appears before any variadic arguments.
- result_qubit_1
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class CZOp(qubit_0, qubit_1)
Bases:
CZOp,CliffordTwoQubitGate,TwoQubitGate,IRDLOperation,Operation,_IRNode,ABC,objectThe controlled-Z gate.
Builds the gate. Each result has the type of its qubit.
- Parameters:
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.cz'
The operation name. Should be a static member of the class
- qubit_0
Access a non-variadic construct which appears before any variadic arguments.
- qubit_1
Access a non-variadic construct which appears before any variadic arguments.
- result_qubit_0
Access a non-variadic construct which appears before any variadic arguments.
- result_qubit_1
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class CliffordTrait
Bases:
OpTraitA trait that signifies every instance of the operation is a Clifford gate.
Passes use it to ask whether a gate is Clifford without listing gates.
- class DeallocateQubitOp(qubit)
Bases:
DeallocateQubitOp,IRDLOperation,Operation,_IRNode,ABC,objectEnds the lifetime of a qubit.
Consumes the qubit and returns nothing. Use it for a qubit that is not measured, so its chain of values has an explicit end. The verifier does not require one.
- Variables:
qubit – The qubit to deallocate.
- Parameters:
qubit¶ (
SSAValue|Operation) – The qubit to deallocate.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.deallocate_qubit'
The operation name. Should be a static member of the class
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class HOp(qubit)
Bases:
HOp,CliffordOneQubitGate,OneQubitGate,IRDLOperation,Operation,_IRNode,ABC,objectThe Hadamard gate.
- Parameters:
qubit¶ (
SSAValue|Operation) – The qubit to act on. The result has the same type.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.h'
The operation name. Should be a static member of the class
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class IdentityOp(qubit)
Bases:
IdentityOp,IRDLOperation,Operation,_IRNode,ABC,objectIdentity gate — passes the qubit state through unchanged.
Used as a canonical no-op placeholder, e.g. after gate cancellation leaves a qubit with an empty operation sequence before dead-qubit elimination runs.
- Variables:
qubit – Qubit operand to which the gate is applied.
result – The qubit after the gate.
- Parameters:
qubit¶ (
SSAValue|Operation) – The qubit to act on. The result has the same type.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.identity'
The operation name. Should be a static member of the class
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class MeasureOp(qubit)
Bases:
MeasureOp,IRDLOperation,Operation,_IRNode,ABC,objectMeasures a single qubit.
Consumes the qubit and returns the outcome as an
i1.- Variables:
qubit – The qubit to measure.
result – The measurement outcome.
- Parameters:
qubit¶ (
SSAValue|Operation) – The qubit to measure.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.measure'
The operation name. Should be a static member of the class
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class PhysicalQubitType(index)
Bases:
PhysicalQubitTypeA physical qubit type, assigned after placement.
- Variables:
index – The index of the qubit on the device. Must not be negative.
- classmethod get_irdl_definition()
Get the IRDL attribute definition.
-
index:
IntegerAttr= <xdsl.irdl.attributes._ParameterDef object>
- name: ClassVar[str] = 'gate.qubit.physical'
The attribute name should be a static field in the attribute classes.
- verify()
Check that the attribute parameters satisfy the expected invariants. Raise a VerifyException otherwise.
- Return type:
None
- class QubitType(*parameters)
Bases:
ParametrizedAttribute,TypeAttributeAbstract base for qubit type.
Concrete subtypes distinguish algorithmic qubits (pre-placement, directly from the source program) from physical qubits (post-placement), allowing placement to be expressed as a type-level rewrite without any structural change to the circuit ops.
- name: ClassVar[str] = 'gate.qubit'
The attribute name should be a static field in the attribute classes.
- class RZOp(qubit, theta)
Bases:
RZOp,OneAngleGate,IRDLOperation,Operation,_IRNode,ABC,objectA rotation about the Z axis by
theta.Builds the gate. The result has the type of the qubit.
- Parameters:
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.rz'
The operation name. Should be a static member of the class
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- result
Access a non-variadic construct which appears before any variadic arguments.
- theta
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class ResetOp(qubit)
Bases:
ResetOp,IRDLOperation,Operation,_IRNode,ABC,objectResets a qubit to the |0⟩ state.
MeasureOpconsumes its qubit, so a measured qubit cannot be reset.- Variables:
qubit – Qubit operand to which the reset is applied.
result – The qubit after the reset.
- Parameters:
qubit¶ (
SSAValue|Operation) – The qubit to act on. The result has the same type.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.reset'
The operation name. Should be a static member of the class
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class U3Op(qubit, theta, phi, lam)
Bases:
U3Op,ThreeAngleGate,IRDLOperation,Operation,_IRNode,ABC,objectThe general single-qubit gate U3(theta, phi, lambda).
Builds the gate. The result has the type of the qubit.
- Parameters:
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- lam
Access a non-variadic construct which appears before any variadic arguments.
- name: ClassVar[str] = 'gate.op.u3'
The operation name. Should be a static member of the class
- phi
Access a non-variadic construct which appears before any variadic arguments.
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- result
Access a non-variadic construct which appears before any variadic arguments.
- theta
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
- class XOp(qubit)
Bases:
XOp,CliffordOneQubitGate,OneQubitGate,IRDLOperation,Operation,_IRNode,ABC,objectThe Pauli-X gate.
- Parameters:
qubit¶ (
SSAValue|Operation) – The qubit to act on. The result has the same type.
- classmethod get_irdl_definition()
Get the IRDL operation definition.
- name: ClassVar[str] = 'gate.op.x'
The operation name. Should be a static member of the class
- qubit
Access a non-variadic construct which appears before any variadic arguments.
- result
Access a non-variadic construct which appears before any variadic arguments.
- traits: ClassVar[OpTraits] = <xdsl.ir.core.OpTraits object>
Traits attached to an operation definition. This is a static field, and is made empty by default by PyRDL if not set by the operation definition.
- verify_()
Submodules
- qat.experimental.dialect.gate.ir.ops module
AllocateAlgorithmicQubitOpAllocatePhysicalQubitOpAllocateQubitOpBarrierOpCXOpCZOpCliffordDirectionalTwoQubitGateCliffordOneQubitGateCliffordTwoQubitGateDeallocateQubitOpDirectionalTwoQubitGateHOpIdentityOpMeasureOpOneAngleGateOneQubitGateRZOpResetOpThreeAngleGateTwoQubitGateU3OpXOp
- qat.experimental.dialect.gate.ir.traits module
- qat.experimental.dialect.gate.ir.types module