Skip to content

Dialects and Kernels

Bloqade provides a set of pre-defined domain specific languages (DSLs), with which you can write your programs and circuits. We call these DSLs dialects. For a list of available dialects see below.

Once you have defined your kernel, you can inspect their Intermediate Representation (IR), apply different optimizations using compiler passes, or run them on a (simulator) device.

When running code that targets a specialized execution environment, there are typically several layers involved. At the surface, the programmer writes functions in a syntax that may resemble a host language (e.g., Python), but is actually expressed in a dialect — a domain-specific variant with its own semantics. A decorator marks these functions so they can be intercepted before normal host-language execution. All dialects can be used by decorating a function.

Instead of running directly, the kernel function body is parsed and translated (lowered) into an intermediate representation (IR). This IR can be manipulated (e.g. to perform optimizations) and can later be executed by an interpreter that understands the dialect’s semantics. The interpreter uses an internal instruction set to execute the code on the intended backend, which may be a simulator, virtual machine, or physical device. This separation lets developers write high-level, expressive code while the interpreter ensures it runs correctly in the target environment. QuEra’s Kirin provides the infrastructure that allows us to define custom dialects tailored towards the needs of programming neutral atom quantum computers in Bloqade. While the dialects are not Python syntax, Kirin still uses the Python interpreter to execute the code.

Bloqade offers a few different dialects with which you can write your programs. All dialects have some advantages for particular applications.

If you are unsure which dialect best suits your needs, have a look at the high-level overview of the (non-exhaustive) list of use cases below. Also, we recommend having a look at the Structural QUantum INstructions (SQUIN) dialect as it is the most general purpose dialect available and is centrally used in the compilation pipeline.

While the documentation in this section provides some information on the background and a high-level overview, it is also often convenient to learn from examples. Have a look at the (growing) examples collection, where you can find different implementations of quantum programs using different dialects.

This is the central dialect of bloqade-circuit, with which you can write your quantum programs. Rather than just defining circuits in terms of gates and qubits, this dialect also makes it possible to use control flow. Have a look at the dedicated documentation page and the corresponding API reference.

Use cases:

  • Writing a program that represents a circuit.
  • If you require control flow (loops and if-statements, …) and composability (function definitions, recursion, …).
  • Simulation including noise.

There are a number of dialects with which you can write kernels that represent programs in the Quantum Assembly Language (QASM2). More details can be found here. Also, have a look at the full qasm2 API reference.

Use cases:

  • Write circuits using the QASM2 standard.
  • Composability with other tools that integrate with QASM2, but not with bloqade directly.
  • Control flow via the extended dialect (not always compatible with native QASM2).

For quantum error correction applications, you may want to use this dialect. See this documentation page for more details. The full API documentation is available here.

Use cases:

  • Quantum error correction.
  • Stabilizer codes.