Skip to content

✨ Add QIR Adaptive Profile non-bit output recording to the QIR runtime #1797

@rturrado

Description

@rturrado

Problem Statement

PR #1766 added QIR Adaptive Profile format routing to the DDSIM QDMI Device. The program-format gate accepts QIRADAPTIVE{MODULE,STRING} and submitQIRProgram runs them through the JIT. The runtime already handles __quantum__rt__read_result + br i1, so an Adaptive program that only branches on measurement results works end-to-end.

What is still missing is the set of recording functions Adaptive programs use to emit classical compute outputs alongside measurement results. The spec defines five additional __quantum__rt__*_record_output symbols (bool, int, float, tuple, array) that are not currently implemented in the runtime, so any Adaptive program that emits a classical bool, int, or float value, a tuple, or an array fails to link at JIT time.

QIR Adaptive Profile spec: https://github.com/qir-alliance/qir-spec/blob/main/specification/profiles/Adaptive_Profile.md

Blocks: #1798

Proposed Solution

Scope

  1. Five new runtime recording functions declared in QIR.h and implemented in QIR.cpp: __quantum__rt__bool_record_output, __quantum__rt__int_record_output, __quantum__rt__float_record_output, __quantum__rt__tuple_record_output, __quantum__rt__array_record_output.
  2. JIT symbol registration: register the five new symbols in Session::registerRuntimeSymbols so JIT-compiled Adaptive programs can resolve them.
  3. Test circuit and tests: a new test circuit exercises every new function in one run. Runtime-level and QDMI-level tests assert the exact emitted format.

Out of scope

  • Switching the runtime to the spec-mandated HEADER / START / END + <TYPE>\t<value>\t<label> output schema. That work is tracked separately under "Add QIR Output Schemas support" and depends on this PR.

Metadata

Metadata

Assignees

Labels

QIRAnything related to QIRc++Anything related to C++ codeenhancementImprovement of existing feature
No fields configured for Feature.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions