Skip to content

Reject repeated static qubits before QIR simulation and gate decomposition - #4201

Open
Andrew Casey (amcasey) wants to merge 2 commits into
mainfrom
amcasey/gh4085_4111
Open

Andrew Casey (amcasey) wants to merge 2 commits into
mainfrom
amcasey/gh4085_4111

Conversation

@amcasey

Copy link
Copy Markdown
Member

Fixes #4085
Fixes #4111

agent and others added 2 commits November 5, 2026 04:03
…ition

Fixes #4085
Fixes #4111

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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:

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understand this check and could be persuaded to drop it from the PR (along with whichever bug it fixes)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants