🐛 Declare capacity for sparse QIR resource IDs - #2447
Merged
Conversation
Preserve static qubit and result IDs while declaring capacity through the highest ID. Reject capacities that cannot fit the QIR 64-bit count before changing metadata. Cover empty, dense, repeated, and sparse IDs in both profiles, preserve qc.static 7 through the compiler, and check atomic capacity rejection. Assisted-by: GPT-6 via Codex
Suppress the naming check only on the two SetUp overrides whose names GoogleTest requires. Assisted-by: GPT-6 via Codex
Use designated initializers and trailing commas, and remove a redundant cast. Test behavior is unchanged. Assisted-by: GPT-6 via Codex
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
burgholzer
approved these changes
Sep 7, 2026
burgholzer
left a comment
Member
There was a problem hiding this comment.
This feels reasonable. Feel free to merge once green!
12 tasks
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
QIR metadata counted distinct static resource IDs, which understated the capacity needed for sparse IDs. The metadata pass now declares capacity through the highest recognized static qubit or recorded result ID:
qc.static 7retains ID 7 and declaresrequired_num_qubits="8". It diagnoses IDs whose required capacity exceeds an unsigned 64-bit count before changing metadata.Addresses the sparse-resource-capacity finding in #2287. This PR is independent of the other audit fixes and starts from
mainat5f6a8cfa2. No new dependencies. The change retains the existing direct constant-to-pointer discovery and dynamic-resource behavior.Validation: all 121 QIR IR tests and 165 compiler tests passed on the combined validation branch containing the four audit fixes. Coverage includes sparse and duplicate IDs, capacity boundaries, and compiler resource metadata.
uvx nox -s lintanduvx nox -s cpp-lintpassed; the latter checks every line of each changed C++ file.GPT-6 via Codex assisted the implementation, tests, and PR text.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).