♻️ Define target compilation with payload specifications - #2219
Conversation
b53e303 to
c62e088
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
c62e088 to
ae5b72f
Compare
burgholzer
left a comment
There was a problem hiding this comment.
This one will likely still need a bit of work to iron out the details.
ae5b72f to
b0dd192
Compare
|
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
b0dd192 to
bb0240b
Compare
|
This looks much cleaner now. And should also be ready. |
bb0240b to
28284fa
Compare
|
@simon1hofmann @denialhaag any feedback on this one from your side? |
Going through this now and will provide feedback in around 15min. |
simon1hofmann
left a comment
There was a problem hiding this comment.
Also went through the changes here and they look really clean 👍
denialhaag
left a comment
There was a problem hiding this comment.
Thanks for the continued improvements, @simon1hofmann! 🙂 Overall, this looks pretty good to me. I only have a few remarks:
2a25b61 to
245a55f
Compare
Record complete compiler-target facts and one exact payload execution contract as typed module metadata. Assisted-by: GPT-5.6 Sol via Codex
Represent the selected hardware target and payload specification as one validated target environment. Cache that value through the MLIR analysis manager for mapping, native synthesis, and conformance. Derive targeted compiler output from the selected payload format in the C++, Python, and mqt-cc APIs. Keep untargeted output selection independent. Assisted-by: GPT-5.6 Sol via Codex
Declare the dialect used by runtime-angle synthesis and cover a fresh context that does not preload it. Assisted-by: GPT-6 via Codex
Zero-fill omitted numeric components at the payload snapshot boundary. Accept the same syntax in typed MLIR and keep compiler output selection exact. Assisted-by: GPT-6 via Codex
Use DDSIM for executable QIR examples and state the environment required by the C++ pipeline builder. Assisted-by: GPT-6 via Codex
Co-authored-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com> Signed-off-by: simon1hofmann <119581649+simon1hofmann@users.noreply.github.com>
Assisted-by: OpenAI via Codex
Assisted-by: OpenAI via Codex
Preserve upstream regressions after rebasing onto main by using the existing target-environment helpers. Assisted-by: OpenAI via Codex
245a55f to
8a050a0
Compare
denialhaag
left a comment
There was a problem hiding this comment.
Thanks for addressing all of my comments, @simon1hofmann! I'll leave the final comment open for now, but I'll not die on that hill; you can resolve it whenever we have come to any conclusion. I'm approving for now. Feel free to request another review if there are new changes I can have a look at! 🙂
|
Also looks good to me, will leave the final check to @burgholzer before merging. |
|
I'll tackle this one next |
Make the pipeline take one environment and reuse its prepared target in the cached analysis. Standalone passes decode the typed pair on demand. Remove the unused DLTI extension and query layer. Assisted-by: GPT-6 via Codex
burgholzer
left a comment
There was a problem hiding this comment.
I ran this through another iteration with the goal of simplifying the implementation, which was pretty successful I believe.
I'd vote for getting this in now and looking at the fallout in subsequent audits until the release.
* ✨ Legalize control flow for selected payloads Use stock MLIR normalization, bounded static loop unrolling, and dialect conversion to match residual structured control flow to the selected payload specification. Co-authored-by: Simon Hofmann <simon.t.hofmann@tum.de> Assisted-by: GPT-5.6 Sol via Codex * ♻️ Remove redundant modifier legality exemptions QCO modifiers do not implement branch interfaces, so the existing fallback already accepts them. Assisted-by: GPT-6 via Codex * 📝 Align control flow release scope Preserve the capability snapshot while distinguishing Core 4.0 compiler review from the separate QDMI 1.4 adaptation. Assisted-by: GPT-6 via Codex * ♻️ Simplify structured payload legalization Use native static trip counts while retaining literal-bound proofs and full unroll safety limits. Accept single-case switches with multiway support. Require structured input at pipeline entry and remove CFG lifting and the redundant cleanup after control legalization. Assisted-by: GPT-6 via Codex * ♻️ Validate loop inputs before legalization Check the supported SCF loop input form at both pass entry points, so loop legalization can rely on explicit iteration arguments. Keep branch checks after unrolling and leave the QCO linearity contract unchanged. Assisted-by: OpenAI Codex * ♻️ Clarify control-flow pass names Keep payload-loop unrolling separate from residual control-flow checks so constant propagation and QCO cleanup can run between them. Leave the factor-based quantum-loop optimization unchanged. Assisted-by: OpenAI Codex * ♻️ Centralize control-flow capability IDs Keep the compiler snapshot identifiers beside ProgramCapability and ProgramConstraint so producers and legalization share their spellings. Do not depend on the draft QDMI capability API. Assisted-by: OpenAI Codex * 🧪 Keep control fixtures allocation-independent Exercise control-flow rejection with valid quantum inputs and remove unrelated quantum operations from classical fixtures. Assisted-by: OpenAI Codex * 🐛 Check the width of fully unrolled loop steps Reject signed step truncation before native unrolling mutates the loop. Preserve safe signed and unsigned narrow-integer loops, and check their observed induction values. Assisted-by: OpenAI Codex * 🐛 Bound switch expansion before rewriting Check payload depth and a compiler nesting ceiling before moving case regions. Build accepted chains iteratively and retain native multiway switches. Cover expansion boundaries, moved control, state selection, and cumulative loop cloning. Assisted-by: OpenAI Codex * ♻️ Reuse native trivial-loop promotion Reuse the native zero/one-trip utility, apply required C++ initializer style, and replace stale local handoff notes with scoped validation. Keep the switch safety comment purely technical. Assisted-by: OpenAI Codex * 🧪 Exercise payload limits through frontends Replace three handwritten positive fixtures with OpenQASM imports and test a live Qiskit classical switch against selected capabilities. Keep the focused raw-MLIR safety regressions and production contract unchanged. Assisted-by: OpenAI Codex * 📝 Group payload legalization with target compilation Move the #2162 reference beside #2219 and describe payload-aware control-flow legalization in the existing target-compilation entry. Assisted-by: OpenAI Codex * 🐛 Legalize empty and unsigned counted loops Reuse LLVM's state and induction-value remapping for terminator-only loops within the existing clone budget. Zero-extend unsigned bounds before checking whether full unrolling is safe. Add frontend state-permutation and direct induction-value regressions, and cover unsigned bounds above the signed range of their type. Assisted-by: GPT-6 via Codex --------- Co-authored-by: Lukas Burgholzer <burgholzer@me.com>
🤖 AI text below 🤖
Lead: @simon1hofmann. Cross-repository coordination: @burgholzer.
Description
Keep the compiler-only selected-program capability prototype independent of QDMI runtime adoption. Typed metadata and a cached target-environment analysis connect target selection to compilation without requiring unreleased QDMI APIs.
Compiler workstream: main → #2219 → #2162. QDMI adaptation remains the separate integration PR #2227. This compiler-only work targets Core 4.0, subject to Simon's compiler contract review and current CI. It does not require QDMI 1.4 or approval of the later QDMI metadata contract. #2131 tracks compiler requirements; #2365 coordinates the separate Core 4.1/QDMI 1.4 adaptation.
Retain the compiler behavior already released onto main through #2218/#2323/#2215: unknown topology or gate sets fail during inference, variadic controlled DDSIM gates and zero-arity global phase remain supported, and placement/decomposition retain their validated target. No driver replacement, batching or metadata cleanup is included.
Local validation
AI-assisted restructuring; human design review remains required.
Compiler contract review
Model the capabilities of the selected program/target combination rather than assuming a format's full language is executable. Keep the initial feature vocabulary bounded and informed by OpenQASM and QIR. Validate representative benchmark targets without requiring a QDMI 1.4 device. The later QDMI adapter may expose only a subset until its independent contract is ready.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).