Installation
Conversions
This section highlights the different ways in which the converterload() can be used with various formats and input types. Each conversion method is demonstrated with practical examples below.
PyQIR String to Squin kernel
Convert PyQIRIR string to a Squin kernel:
PyQIR Module to Squin kernel
Convert a PyQIRModule object to a Squin kernel:
Conversion from File
Load PyQIR IR from afile (.ll for LLVM IR text or .bc for LLVM bitcode):
Code
Integration with OpenQASM 3
ConvertOpenQASM3 programs to Squin kernels using qbraid-qir:
Integration with CUDA-Q
ConvertCUDA-Q kernels to Squin kernels
Code
CUDA-Q is capable of exporting QIR using multiple profiles (such
as
qir-base, qir-adaptive, etc.). Currently, the qbraid-qir Squin integration
supports only QIR generated with the qir-base profile. Ensure that when
using cudaq.translate, you specify format=“qir-base” for
compatibility.Using Qubit Register as Argument
Create a kernel that accepts a qubit register as an argument, enabling composition of kernel functions:Supported Gates
The following gates are currently supported for conversion from PyQIR to Squin kernels:| QIR Gate | Squin Gate | Description |
|---|---|---|
__quantum__qis__h__body | squin.h | Hadamard gate |
__quantum__qis__x__body | squin.x | Pauli-X gate |
__quantum__qis__y__body | squin.y | Pauli-Y gate |
__quantum__qis__z__body | squin.z | Pauli-Z gate |
__quantum__qis__s__body | squin.s | S gate (π/2 phase) |
__quantum__qis__t__body | squin.t | T gate (π/4 phase) |
__quantum__qis__s__adj | squin.s_adj | S† gate (adjoint S) |
__quantum__qis__t__adj | squin.t_adj | T† gate (adjoint T) |
__quantum__qis__rx__body | squin.rx | Rotation around X-axis |
__quantum__qis__ry__body | squin.ry | Rotation around Y-axis |
__quantum__qis__rz__body | squin.rz | Rotation around Z-axis |
__quantum__qis__cnot__body | squin.cx | Controlled-NOT gate |
__quantum__qis__cz__body | squin.cz | Controlled-Z gate |
Next Steps
Our current implementation provides comprehensive support for standard QIR gates and circuit conversion. We are actively working on expanding functionality in the following areas:- Measurement operations: Support for measurement operations is planned for a future release.
- Classical control flow: Conditional gates and classical control flow are on our roadmap.
- Custom gates: We currently support all standard QIR gates listed in the Supported Gates table, with plans to extend support for custom gate definitions.
