Fix high-impact compiler, backend, and algorithm regressions - #14
Open
wuzp15 wants to merge 59 commits into
Open
Fix high-impact compiler, backend, and algorithm regressions#14wuzp15 wants to merge 59 commits into
wuzp15 wants to merge 59 commits into
Conversation
wuzp15
marked this pull request as ready for review
July 22, 2026 09:08
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.
Summary
This PR fixes independently reproduced correctness and robustness failures across compilation, circuit differentiation, variational algorithms, simulators, QASM, and cloud assembly. Each defect is isolated in its own commit and guarded by a focused regression test.
Compilation and IR
CY, nested controlledCX, arbitrary controlled matrix gates, and nested controlled single-qubit gatescrxAutograd and measurement
qgradreturn one gradient per argumentVariational algorithms
Simulators and cloud backend
CCXdecompositions)Impact
Before these fixes, valid programs could silently produce incorrect states, phases, expectation values, gradients, QASM, cloud circuits, or optimizer outputs. Several failures were silent scientific errors: asymmetric Pauli terms acted on the wrong qubit, controlled-rotation parameter shift returned the wrong derivative, nested controls introduced observable relative phase, batched expectation values lost rows, and repeated cloud substitutions could swap a CCX target with a control.
Unsupported noncommuting default-QAOA synthesis now fails closed instead of returning an order-dependent approximation without an approximation contract.
Regression tests
The files under
tests/are permanent unit/regression tests, not disposable reproduction artifacts. Each is a minimized executable reproduction and should merge with its corresponding fix.Build and test the installed package outside the source tree so the local
spinqit/directory does not shadow the compiled native extension:Validation
1.000000000000throughout; worst Torch fidelity:0.9999989718201e-70.99999999999999890.9999999999999993python -m pip checkandgit diff --checkpassed