QASM support
Currently Supported Constructs
The qbraid_qir.qasm3.qasm3_to_qir()
converter supports the following OpenQASM 3 constructs:
1. Register Declarations
OpenQASM declarations of all forms qreg
, qubit
, bit
, and creg
are supported.
2. Quantum Measurements
OpenQASM measurements are supported which involve single qubit measurement and full register measurements. Range based measurements are not supported currently.
3. Quantum Reset
Resets are supported on declared quantum registers in all forms.
4. Quantum Gates
pyqir._native
gates are supported along with support forU3
and U2 gates. TheU[x]
gates are defined in terms of existingrx
andrz
gates according to the decomposition present on the Qiskit UGate documentation and PhaseGate documentation.- Full set of the openqasm3 “stdgates.inc” gates are supported. These gates are decomposed with the help of the
pyqir._native
gate set and subsequently converted to QIR.
5. Quantum Barriers
Barriers are supported only if they are placed on ALL the qubits in the circuit. For example:
6. Custom Quantum Gates
Gates defined by users are supported as long as they are defined in terms of pyqir._native
gate set. Identifier mapping in gate parameter expressions is not supported at the moment. Example:
7. Simple Branching Statements
Since QIR supports branching on a measurement result, single bit branching statements are supported at the moment. General boolean expressions and support for branching on full registers will be added in future. For example:
8. Expressions
- General expression evaluation involving literals and constants is supported.
- Expressions involving constants and variables are fully supported.
- Expressions with arrays are also supported (in global scopes).
9. Variables and Types
- Scalar types
int
,uint
,float
,bool
andbit
with arbitrary sizes are supported. array
type is supported forint
,uint
,float
,bool
andbit
.complex
andangle
types are not supported yet.
10. Loops
for
loops are supported at the moment with while
loop support coming soon. For example:
11. Aliasing
- Aliasing quantum registers is supported and can be used to refer to the same quantum register with different names.
- Aliases are currently supported in global scope of the qasm3 program, with support for function scopes coming soon.
12. Subroutines
We support QASM3 subroutines in the QIR converter
13. Switch
Switch statements in QASM3 are supported in the QIR converter. These are defined according to the OpenQASM3 spec and support all the features mentioned in the specification.