amazon-braket / amazon-braket/qirtoqasm

Lower QIR output-recording intrinsics to OpenQASM 3 output variables

Open
#18 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**
Translate QIR's output-recording calls — `__quantum__rt__result_record_output`, `__quantum__rt__array_record_output`, plus the i1-load / store-to-alloca patterns some producers emit for labeled output under the Base Profile — into corresponding OpenQASM 3 `output bit[N] ;` declarations with appropriate assignments. Today these are out of scope and surface as `Unsupported`.

**How would this feature be used? Please describe.**
Producers that emit named outputs (rather than relying on positional measurement order) currently can't be translated under the Base Profile, even though their QIR is otherwise simple. A small example: a QIR module that records two results under labels `"q0"` and `"q1"` should translate to OpenQASM 3 with two `output bit[1]` declarations and assignments at the corresponding measurement sites.

**Describe alternatives you've considered**
Today users either fall back to the Adaptive Profile (which carries unrelated semantic weight) or rewrite their producer to emit unlabeled measurements. Both are workarounds rather than fixes.

**Additional context**
Output-variable lowering is largely additive: it touches the parser (recognise the intrinsics), the translator (allocate names and emit declarations + assignments), and the printer (already supports `output bit[N]` declarations). It does not require AST changes for measurement, gate, or branching nodes.

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.