Skip to main content

FlagQuantum Compiler QSteed

flagquantum-compiler-qsteed is an independently installed circuit compiler plugin for FlagQuantum. It translates FlagQuantum CircuitIR to a PyQuafu QuantumCircuit, invokes QSteed's real transpiler, and translates the compiled circuit back to CircuitIR.

The first release deliberately supports one closed, testable slice:

  • static h, x, rx, ry, rz, and cx instructions with numeric angles;
  • basis lowering to a selected subset of those gates, with topology routing on the fixed six-gate basis;
  • an optional undirected coupling map over the circuit's existing wires;
  • deterministic QSteed basis lowering and SABRE routing;
  • restoration of QSteed's final physical layout to FlagQuantum's logical wire order.
  • Quafu calibration targets with automatic or explicitly ordered physical subgraph selection and a target_qubits result; physical identifiers never replace logical QASM wires.

Measurements, observables, symbolic parameters, custom matrices, dynamic operations, additional target fields, and larger physical topologies are rejected. There is no compiler substitution or fallback. Omitting coupling_map explicitly requests basis compilation without topology routing. For a Quafu chip_info target, omitting target_qubits lets QSteed choose the subgraph. Supplying it locks the logical-to-physical order after existence, uniqueness, and connectivity validation; the plugin never substitutes another mapping.

Installation

Install the published FlagQuantum release, the verified QSteed build, and this plugin in order:

python -m pip install flagquantum==0.2.0
python -m pip install "qsteed @ git+https://github.com/BAQIS-Quantum/qsteed.git@46584efde731aea9eec27b5466919b76fe5f3184"
python -m pip install flagquantum-compiler-qsteed==0.1.1

The plugin requires FlagQuantum >=0.2,<0.3 and QSteed 0.2.3+quafu.sqc. FlagQuantum and the plugin are available on PyPI; the verified QSteed build still requires the pinned Git installation above. PyPI QSteed 0.2.2 is not a supported substitute. Installing FlagQuantum alone or its quafu extra does not install this compiler plugin.

Python 3.12 is the verified release setup. The declared Python 3.10–3.12 range still needs a full compatibility matrix.

For development from this repository, install FlagQuantum as above, then run:

python -m pip install -r requirements-qsteed.txt
python -m pip install -e ".[test]"
python -m pytest -q

Version 0.1.1 updates installation guidance for the published FlagQuantum 0.2.0 release. Compiler behavior and dependency constraints are unchanged.

Compile a circuit

This offline example needs no provider credentials and submits no hardware job:

import flagquantum as fq

circuit = fq.Circuit(3).h(0).cx(0, 2)
compiled = fq.compile(
    circuit,
    compiler="qsteed",
    target={
        "basis_gates": ("h", "x", "rx", "ry", "rz", "cx"),
        "coupling_map": ((0, 1), (1, 2)),
    },
)
print(compiled.instructions)

See release preparation for publication prerequisites and artifact checks.

Advanced extension lifecycle

from flagquantum.ecosystem.extensions import (
    CapabilityRequest,
    ExtensionConfig,
    discover_extensions,
)

import flagquantum as fq

source_ir = fq.Circuit(3).h(0).cx(0, 2).to_ir()
registry = discover_extensions("compiler")
handle = registry.negotiate(
    "compiler",
    "qsteed",
    CapabilityRequest(required=frozenset({"circuit_ir"})),
)
handle.start(ExtensionConfig())
try:
    compiled = handle.invoke(
        "compile",
        source_ir,
        target={
            "basis_gates": ("h", "x", "rx", "ry", "rz", "cx"),
            "coupling_map": ((0, 1), (1, 2)),
        },
    )
finally:
    handle.close()

QSteed treats the coupling graph as bidirectional in this compiler path. The plugin therefore validates two-wire instructions against undirected edges.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flagquantum_compiler_qsteed-0.1.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flagquantum_compiler_qsteed-0.1.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file flagquantum_compiler_qsteed-0.1.1.tar.gz.

File metadata

File hashes

Hashes for flagquantum_compiler_qsteed-0.1.1.tar.gz
Algorithm Hash digest
SHA256 00664bdbd96d6e2936f5f55fe4f49748557fc1e90be71ee6a08de1a9bccb7050
MD5 6e91ad33bb97edd49917918d2c7af368
BLAKE2b-256 8a99f2cf7a141c6170447fd32c97339941634e71e25985e0d2694f3d099d8699

See more details on using hashes here.

File details

Details for the file flagquantum_compiler_qsteed-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for flagquantum_compiler_qsteed-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 190b31ec726207b4f0a319ecbe29b75b3d90031bb988d74d0e0558c3879481e2
MD5 6cf499ce951252f083a81a82e5560a05
BLAKE2b-256 8f665cad3d7ac7b2f5f3fdb597f4c79a0a05ab3ae743712137956d2c95eae081

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page