Skip to main content
Execute the QIR program using the qir-runner command line tool:

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 for U3 and U2 gates. The U[x] gates are defined in terms of existing rx and rz 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 and bit with arbitrary sizes are supported.
  • array type is supported for int, uint, float, bool and bit.
  • complex and angle types are not supported yet.

10. Loops

Both for and while loops are supported at the moment. 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
Subroutines are supported in QASM3 and can be defined using the def keyword and are only allowed in the global scope.
Subroutines can be called from within the main program or from other subroutines.
  • Quantum arguments of type qubit are supported in subroutines.
  • Classical arguments are supported for any scalar type and can return values of any scalar type.
  • All argument validations mentioned in the OpenQASM3 specification are supported.
  • Add mutable and readonly arrays as classical arguments in a subroutines
  • Support looping statements inside a subroutine - Support switch statements inside a subroutine - Support for aliasing in a subroutine

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.