qf++ is a framework for quantum compilers. It generates structurally valid quantum programs across multiple quantum software stacks, then differentially tests them by comparing circuit simulation outputs across compiler optimisation levels.
# 1. Setup
python3 -m scripts.setup
# 2. Run CI pipeline (10 circuits per grammar)
uv run -m scripts.run --num-tests 10
# 3. Run nightly (1200 circuits, saves interesting ones)
uv run -m scripts.run --nightly --num-tests 1200 --grammars pytket qiskit
# 4. Use the interactive fuzzer REPL directly
./build/qf
> pytket program # set grammar + entry point
> 5 # generate 5 circuits
> quitTo run inside a separate environment, pull the docker image using
docker pull ghcr.io/ilaniwumbwe/qutefuzz-env:latestIf you prefer to build the image from sratch, run
./scripts/docker/build.shthen
./scripts/docker/run.shto create a docker container and start a shell inside it. From there, run setup commands as normal.
To install external repos
python3 -m scripts.setup --libs {EXTERNAL LIBS}To clone and build cuda-quantum from source without coverage collection enabled
python3 -m scripts.setup --libs cuda-quantumTo clone and build from source with coverage collection enabled
python3 -m scripts.setup --covNote:
-
Run script is not set up to run fuzzing campaigns on instrumented compilers, due to the large volumes of data that would be dumped, and is not collected and deleted in batches. The coverage flag is more for development testing to see how well the test cases stress test the compiler. Currently, only CUDAQ compiler can be instrumented.
-
If
conancommand fails, this is because the run needs to happen within the virtual env. Source first withsource .venv/bin./activatethen re-run setup command.
-
Make sure that any time you use
uv run, it is with the--no-syncflag, or usepython3directly. This is because the setup script in dev mode "tampers with" the .venv, uv sees that and tries to sync everything to match the lockfile. As a result, it reinstalls the release, uninstrumented pytket version from PyPI.
| Grammar file | Framework | Test method |
|---|---|---|
pytket.qf |
Pytket (TKET compiler) | KS test across optimisation levels 0–3 |
qiskit.qf |
Qiskit + Aer | KS test across optimisation levels 0–3 |
cirq.qf |
Cirq | KS test across 3 custom transpile levels |
pennylane.qf |
PennyLane Lightning | KS test across 4 transform pipelines |
cudaq.qf |
CUDA-Q | KS test across optimisation levels 0-3 |
| QSS | Bug in | Status |
|---|---|---|
| Pytket | optimiser | fixed |
| Pytket | optimiser | ack |
| CUDA-Q | parser | ack |
| CUDA-Q | parser | |
| Qiskit | basis translator | ack, duplicate |
| Pytket | parser | |
| Pytket | routing pass |
- Linenoise library for nicities in REPL loop like command history and tab completion.
- Only GCC/clang compilers due to some use of GCC pragmas
- >= C++20 required
