Repository navigation
Reject repeated static qubits before QIR simulation and gate decomposition - #4201
Open
Andrew Casey (amcasey) wants to merge 2 commits into
Open
Andrew Casey (amcasey) wants to merge 2 commits into
Andrew Casey (amcasey) wants to merge 2 commits into
Conversation
Replace the standalone validation visitor with a shared single-call helper used by base and adaptive handlers and before CCX decomposition. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the repeated-qubit validation changes.
No open issues 🎉
What changed in this PR
This PR adds validation for repeated static qubit arguments before QIR simulation and gate decomposition, addressing simulator disagreements and correlated-noise panics reported in #4085 and #4111.
Changes:
- Adds shared qubit-uniqueness validation for adaptive gate and noise calls.
- Applies validation to simulation gate extraction, noise handling, and CCX decomposition.
- Adds regression tests across Base and Adaptive_RIF profiles for CPU, stabilizer, and GPU simulation paths.
| File | Description |
|---|---|
source/qdk_package/tests/test_cpu_simulator.py |
Tests rejection of repeated qubits in multi-qubit gates. |
source/qdk_package/tests/test_correlated_noise.py |
Tests repeated noise-qubit rejection with and without noise enabled. |
source/qdk_package/qdk/simulation/_simulation.py |
Validates qubit arguments before gate extraction and CCX decomposition. |
source/qdk_package/qdk/_adaptive_pass.py |
Adds shared validation and applies it to adaptive gate and noise calls. |
Review effort: Balanced
| or "qdk_noise" in cast(Function, call.callee).attributes.func | ||
| ): | ||
| pass | ||
| elif "qdk_noise" in cast(Function, call.callee).attributes.func: |
Member
Author
There was a problem hiding this comment.
I'm not sure I understand this check and could be persuaded to drop it from the PR (along with whichever bug it fixes)
Andrew Casey (amcasey)
marked this pull request as ready for review
November 5, 2026 21:59
Andrew Casey (amcasey)
requested review from
Bill Ticehurst (billti) and
Ian Davis (idavis)
as code owners
November 5, 2026 21:59
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.
Fixes #4085
Fixes #4111