Repository navigation
✨ Support classical subroutines and array references - #2816
Open
simon1hofmann wants to merge 4 commits into
Open
simon1hofmann wants to merge 4 commits into
simon1hofmann wants to merge 4 commits into
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
🤖 *AI text below* 🤖 Add by-value scalar calls and final returns through the OpenQASM frontend, QC/QCO, and OpenQASM export using ordinary functions. Preserve bit-copy isolation and reject unsupported signatures and control flow explicitly. Keep array references, general returns, and new backend ABIs for follow-ups. Assisted-by: OpenAI Codex
🤖 *AI text below* 🤖 Borrow typed static or rank-only array views without argument copies. Check initialization, mutability, shape and aliasing; preserve mutations through OpenQASM round trips, QIR and jeff lowering. Keep array outputs and the host-result ABI out of scope. Assisted-by: OpenAI Codex
simon1hofmann
force-pushed
the
codex/openqasm-scalar-subroutines
branch
from
October 23, 2026 20:57
3bd2f75 to
05b3865
Compare
Reuse the typed and emitted lvalue in compound assignments so calls in the index do not run twice. Preserve initialization and conversion checks. Strengthen the borrowed-view backend oracle and remove redundant checks and completed-plan repetition. Assisted-by: OpenAI Codex
🤖 *AI text below* 🤖 Preserve borrowed-array inlining and one-time lvalues alongside upstream bulk initializers and wide-bit casts. Propagate declaration failures when exporting helpers. Fold promoted call operands before canonical cleanup and dead-value removal. Keep independent specialized-unitary and explicitly seeded custom-pipeline references, and preserve narrow signed initializer values. Validation: 1197 native tests passed with two /dev/full platform skips, 483 focused Python tests passed, and repository lint passed. Whole-file C++ lint remains blocked by unavailable clang-tidy 23. Assisted-by: OpenAI Codex
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Description
Fixes #2593. Based on
main; array-valued outputs (#2592) remain separate.deffunctions with by-value scalar parameters, local variables, and an optional scalar result. Mutable bit vectors use independent local storage.#dim), including strided and rank-reduced views. Passing arguments does not copy their elements; writes reach caller storage.Only final top-level returns are supported. Early/nested returns, recursion, externs, runtime scalar angle signatures, quantum statements/parameters, local arrays, and mutable-global capture are diagnosed. Angle array elements are supported. Empty views require statically known retained extents. Existing runtime bounds/shape preconditions and backend storage limits remain; no new host-result ABI or dependencies.
Review also fixed repeated evaluation in
values[next(counter)] += value, strengthened the backend stride test to inspect caller storage, and removed redundant test checks and plan text.Validation
501 focused tests passed: 214 OpenQASM target, 239 translation, 11 compiler pipeline, 28 jeff round-trip, and 9 DD/memref/call tests. These cover borrowing, initialization/alias rejection, scalar-copy isolation, empty/strided views, single-evaluation compound indices, QIR JIT, and serialized jeff execution. The compound-index regression failed before the fix and passes after it.
Whole-file C++ lint passed for all 15 changed sources against
origin/main; repository lint passed. Additional frontend-header checks found only the existing redundantindices{}initializer inFrontend.h, unchanged frommain. No full suite, benchmarks, or automation were run. CI is not being monitored.Codex assisted with implementation, tests, review, and this description. Human review is still required.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).