Skip to content

Lower QIR output-recording intrinsics to OpenQASM 3 output variables #18

Description

@rmshaffer

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] <name>; 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions