✨ Add non-bit record output functions to the QIR runtime#1799
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Hey @rturrado 👋🏻 |
@burgholzer Hello! Yes, it is. And if you consider that the issue description needs refining and that that can affect the subsequent PR, no problem with that also. |
Nice! The issue descriptions read just fine as they are 🙂👍🏻 |
Thanks so much. No rush at all! |
denialhaag
left a comment
There was a problem hiding this comment.
Thanks a lot for your contribution, @rturrado! 🙂
This looks really good to me! I only left a few minor comments, which you can find below.
denialhaag
left a comment
There was a problem hiding this comment.
This LGTM now! I'll leave the final approval to @burgholzer. 🙂
burgholzer
left a comment
There was a problem hiding this comment.
This is looking great! Thanks for another nice contribution @rturrado 🙌
I have a couple of nitpick comments and maybe some stupid questions. Then this can go in 🚀
- QIR.h, QIR.cpp: implement the five spec-defined `__quantum__rt__{bool,int,float,tuple,array}_record_output` functions used by QIR Adaptive Profile programs to emit classical compute outputs alongside measurement results.
- Runtime.hpp, Runtime.cpp: add `outputValue` and `outputContainer` helpers.
Rename the per-shot bit accumulator (`recordOutput` to `appendMeasurementBit`, `recordedOutputs` to `measurements`, `getRecordedOutputs` to `getMeasurements`) so its name reflects its role in histogram bucketing rather than implying any tie to QIR's `record_output` verb.
- Session.cpp: register the new symbols so JIT-compiled Adaptive programs resolve them.
- AdaptiveRecordOutputs.ll plus runtime- and QDMI-level tests exercising every new function in one circuit.
Assisted-by: Claude Opus 4.7 via Claude Code
Signed-off-by: rturrado <rturrado@gmail.com>
Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Signed-off-by: Roberto Turrado Camblor <rturrado@gmail.com> Signed-off-by: rturrado <rturrado@gmail.com>
Assisted-by: Claude Opus 4.7 via Claude Code Signed-off-by: rturrado <rturrado@gmail.com>
Matches QIR record_output (value, label) so call sites no longer flip args. Assisted-by: Claude Opus 4.7 via Claude Code Signed-off-by: rturrado <rturrado@gmail.com>
- QIR.cpp: add precision rationale for std::ostringstream in float record output. Drop unused <iostream> include. - Runtime.cpp: remove redundant measurements.clear(). - test circuits: bump QIR version to 2.1. Assisted-by: Claude Opus 4.7 via Claude Code Signed-off-by: rturrado <rturrado@gmail.com>
|
Force-pushed to add DCO sign-off to previously unsigned commits. No code change. |
@burgholzer Many thanks! Very much OK with nitpicking. And no stupid questions at all. |
Description
This PR completes the runtime side of QIR Adaptive Profile support. PR #1766 already added the format routing for
QIRADAPTIVE{MODULE,STRING}and the bit-recording infrastructure. This follow-up fills the remaining gap: the five spec-defined__quantum__rt__*_record_outputentry points for non-bit values (bool,int,float,tuple,array). Without them, any Adaptive program emitting classical compute outputs alongside measurement results would fail to link at JIT time.The new entry points emit in MQT Core's current custom
label: valueformat. Switching to the spec-mandatedHEADER / START / ENDoutput schemas (Labeled / Ordered) is tracked separately as a follow-up issue.Fixes #1797