amazon-braket / amazon-braket/qirtoqasm

Optional emission of OpenQASM 3 physical qubits

Open
#20 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
2
Forks
1
Avg merge
3d 21h
Merged PRs (30d)
5

Description

**Describe the feature you'd like**
Currently the translator emits a single virtual register `qubit[N] q;` with `q[i]` indexed references everywhere a qubit is named. Add an opt-in mode that emits OpenQASM 3 physical qubits (`$0`, `$1`, …) instead, controlled by a new field on `TranslateOptions`.

**How would this feature be used? Please describe.**
Workflows that have already mapped a circuit to specific hardware qubits and want the OpenQASM 3 output to reflect that mapping — rather than re-stating it at the consumer — would set the option and receive `$N`-style references. A user-supplied permutation (or the identity mapping by default) would decide which physical qubit each QIR `%Qubit*` index maps to.

**Describe alternatives you've considered**
Post-processing the emitted OpenQASM 3 to substitute `q[i]` with `$N` is straightforward today and is the reasonable workaround. The reason to do it inside qirtoqasm is to keep the output canonical and to centralize the mapping decision.

**Additional context**
Implementing this would require: a new `Options` field, an AST variant distinct from the indexed-identifier shape used everywhere else (physical qubits are bare `$N` tokens, not `name[idx]`), printer routing, and a mapping-source decision (identity, caller-supplied table, future calibration integration). It is purely additive — the default behavior would not change.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.