munich-quantum-toolkit / munich-quantum-toolkit/core
✨ Lower nested modifiers in controlled composites
@burgholzer is already working on this.
Since Sep 19, 2026.
- Dominant language
- C++
- Stars
- 133
- Forks
- 73
- Avg merge
- 17h 34m
- Merged PRs (30d)
- 261
Description
🤖 AI text below 🤖
Problem Statement
Target compilation and synthesis still reject controlled composites whose bodies are nested inside inverse or power modifiers. PR #2565 distributes a control over multiple direct body operations, but a sole composite qco.inv or qco.pow remains a large controlled operation. This affects both Qiskit and OpenQASM input.
Reproducer at e3295d31 (Python 3.14, LLVM/MLIR 23.1.0):
from mqt.core.mlir import (
CompilerTarget, PayloadEncoding, PayloadFormat, PayloadSpecification,
QCProgram, TargetEnvironment,
)
source = """OPENQASM 3.0;
include "stdgates.inc";
gate composite a, b, c { rx(0.37) a; cx a, c; ry(0.61) b; }
qubit[4] q;
ctrl @ inv @ composite q[0], q[1], q[2], q[3];
"""
cap = CompilerTarget.OperationCapability
target = CompilerTarget(
4,
connectivity=CompilerTarget.Connectivity.all_to_all(),
native_operations=CompilerTarget.NativeOperations([
cap("u", 1, 3), cap("cx", 2, 0), cap("gphase", 0, 1),
]),
)
environment = TargetEnvironment(
target,
PayloadSpecification(PayloadFormat("qir", "2.1.0", "base", PayloadEncoding.BINARY)),
)
QCProgram.from_openqasm_str(source).to_qco().synthesize_for_target(environment)
Both synthesize_for_target and compile_for_target fail with target does not support operation 'qco.ctrl' with arity 4 and 0 parameter(s). Removing inv @ succeeds. A Qiskit AnnotatedOperation containing inverse and control modifiers reproduces the same failure; a numeric power of a composite also remains unsupported.
Proposed Solution
Reuse the existing modifier-unrolling machinery where the algebra permits it, starting with inverse bodies. Define the supported subset for composite powers explicitly; powers cannot in general be distributed over noncommuting gates. Keep this normalization independent of the frontend and backend, preserve controlled global phase and wire order, and avoid early symbolic rotation expansion or general arbitrary-unitary synthesis.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.