Block-local commutation analysis#4984
Open
taalexander wants to merge 3 commits into
Open
Conversation
Reject malformed control-polarity metadata and invalid static ExpPauli literals during IR verification. Represent Pauli words as typed symbols so decomposition and later analyses share one validated interpretation instead of repeating string comparisons. Validated with the cudaq-opt target and the four affected lit pipelines. Signed-off-by: Thomas Alexander <talexander@nvidia.com>
CI Summary (
|
| Job | Result |
|---|---|
binaries |
⏩ skipped |
build_and_test |
✅ success |
config_devdeps |
✅ success |
config_source_build |
⏩ skipped |
config_wheeldeps |
✅ success |
devdeps |
✅ success |
docker_image |
⏩ skipped |
gen_code_coverage |
⏩ skipped |
metadata |
✅ success |
python_metapackages |
⏩ skipped |
python_wheels |
⏩ skipped |
source_build |
⏩ skipped |
wheeldeps |
✅ success |
⏩ Skipped jobs (7) — intentionally skipped on PR builds; run on merge_group / workflow_dispatch
| Job |
|---|
binaries |
config_source_build |
docker_image |
gen_code_coverage |
python_metapackages |
python_wheels |
source_build |
All sub-jobs (42) — every matrix leg, with links
| Job | Status | Link |
|---|---|---|
| Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (amd64, gcc12, openmpi) / Dev environment (Python) | ✅ success | view |
| Build and test (amd64, llvm, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (amd64, llvm, openmpi) / Dev environment (Python) | ✅ success | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Python) | ✅ success | view |
| CI Summary | ❔ in_progress | view |
| Configure build (devdeps) | ✅ success | view |
| Configure build (source_build) | ⏩ skipped | view |
| Configure build (wheeldeps) | ✅ success | view |
| Create CUDA Quantum installer | ⏩ skipped | view |
| Create Docker images | ⏩ skipped | view |
| Create Python metapackages | ⏩ skipped | view |
| Create Python wheels | ⏩ skipped | view |
| Gen code coverage | ⏩ skipped | view |
| Load dependencies (amd64, gcc12) / Caching | ✅ success | view |
| Load dependencies (amd64, gcc12) / Finalize | ✅ success | view |
| Load dependencies (amd64, gcc12) / Metadata | ✅ success | view |
| Load dependencies (amd64, llvm) / Caching | ✅ success | view |
| Load dependencies (amd64, llvm) / Finalize | ✅ success | view |
| Load dependencies (amd64, llvm) / Metadata | ✅ success | view |
| Load dependencies (arm64, gcc12) / Caching | ✅ success | view |
| Load dependencies (arm64, gcc12) / Finalize | ✅ success | view |
| Load dependencies (arm64, gcc12) / Metadata | ✅ success | view |
| Load dependencies (arm64, llvm) / Caching | ✅ success | view |
| Load dependencies (arm64, llvm) / Finalize | ✅ success | view |
| Load dependencies (arm64, llvm) / Metadata | ✅ success | view |
| Load source build cache | ⏩ skipped | view |
| Load wheel dependencies (amd64, 12.6) / Caching | ✅ success | view |
| Load wheel dependencies (amd64, 12.6) / Finalize | ✅ success | view |
| Load wheel dependencies (amd64, 12.6) / Metadata | ✅ success | view |
| Load wheel dependencies (amd64, 13.0) / Caching | ✅ success | view |
| Load wheel dependencies (amd64, 13.0) / Finalize | ✅ success | view |
| Load wheel dependencies (amd64, 13.0) / Metadata | ✅ success | view |
| Load wheel dependencies (arm64, 12.6) / Caching | ✅ success | view |
| Load wheel dependencies (arm64, 12.6) / Finalize | ✅ success | view |
| Load wheel dependencies (arm64, 12.6) / Metadata | ✅ success | view |
| Load wheel dependencies (arm64, 13.0) / Caching | ✅ success | view |
| Load wheel dependencies (arm64, 13.0) / Finalize | ✅ success | view |
| Load wheel dependencies (arm64, 13.0) / Metadata | ✅ success | view |
| Prepare cache clean-up | ❔ in_progress | view |
| Retrieve PR info | ✅ success | view |
✅ Required checks (6/6) — declared in .github/required-checks.yml for push
| Required check | Status | Link |
|---|---|---|
| Build and test (amd64, llvm, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (amd64, llvm, openmpi) / Dev environment (Python) | ✅ success | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Python) | ✅ success | view |
| Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (amd64, gcc12, openmpi) / Dev environment (Python) | ✅ success | view |
taalexander
force-pushed
the
feature/block-local-commutation-analysis
branch
from
July 24, 2026 01:17
1cfc218 to
f0e98ef
Compare
Qualify Pauli symbols at their use sites and preserve valid one-, two-, and three-qubit ExpPauli lowering coverage. This addresses review feedback without weakening the existing mismatch diagnostic. Signed-off-by: Thomas Alexander <talexander@nvidia.com>
Provide a reusable read-only query for structural commutation between Quake operators in one value-form block. Keep the block-local qubit identity analysis as an internal, separately tested implementation dependency of the commutation analysis rather than publishing it as an independent review unit. The rule set covers disjoint support, identical operations, diagonal and same-axis operators, Pauli parity, controlled-target compatibility, and mutually exclusive controls. Unsupported values and opaque shared-support semantics remain conservative. The combined tree matches the previously tested identity and commutation PRs; the ownership comment now identifies CommutationAnalysis as the identity helper's consumer. Signed-off-by: Thomas Alexander <talexander@nvidia.com>
taalexander
force-pushed
the
feature/block-local-commutation-analysis
branch
from
July 24, 2026 12:58
f0e98ef to
381651e
Compare
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.
Based on prerequisite work in #4982.
This PR adds a read-only block-local analysis for determining whether two Quake operations are proven to commute. A later transformation will use it to find rewrites across intervening commuting operations.
The analysis assigns virtual-qubit identifiers to supported scalar Quake values, builds operation-local control and target views, and applies a centralized set of exact commutation rules. Identity tracking remains a separate internal analysis and translation unit for separation of concerns, but it is included in this PR as an implementation dependency of
CommutationAnalysis. It is not proposed as the shared identity-analysis API. #4983 is superseded by this combined review unit.The current rules cover disjoint support, the same operation or exact adjoint, computational-basis diagonal operations, common Pauli axes, Pauli-product parity, diagonal actions on controls, compatible controlled targets, and mutually exclusive controls. Unsupported or ambiguous cases remain indeterminate.
The following AI-generated candidates are recorded for later validation rather than included in this PR.
Future extensions
Structurally provable candidates
ExpPauliacting on the controls of another controlled operation.ExpPauliword produced by a compile-time constant expression.Parameter-dependent candidates
Rx(0), against an otherwise noncommuting operation on the same target.%thetaand%theta + 0.PhasedRxoperations whose phase parameters are equivalent modulo the exact phase period.U2orU3parameter combinations that reduce to a known axis rotation.These cases may be better handled by folding and canonicalization before commutation analysis.
Permutation candidates
Swap(a,b)withCZ(a,b), which is invariant under exchanging its two qubits.Swap(a,b)with a symmetric Pauli product such asXX,YY, orZZon(a,b).Swap(a,b)with any multi-qubit operation whose target action is invariant under the same permutation.Swapoperations.Custom-unitary candidates
Basis-aware candidates
H-C(U)-H.These require sequence-level basis, Clifford, or predicate tracking rather than only an operation-pair query.
Cases requiring a different semantic contract