Optimization validation core - #4953
Open
sacpis wants to merge 51 commits into
Open
Conversation
CI Summary (
|
| Job | Result | Link |
|---|---|---|
build_and_test |
❌ failure | view |
Top-level jobs (13)
| Job | Result |
|---|---|
binaries |
⏩ skipped |
build_and_test |
❌ failure |
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) | ❌ failure | view |
| Build and test (amd64, llvm, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (amd64, llvm, openmpi) / Dev environment (Python) | ❌ failure | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Python) | ❌ failure | 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 (3/6) — 3 missing — 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) | ❌ failure | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (arm64, llvm, openmpi) / Dev environment (Python) | ❌ failure | view |
| Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) | ✅ success | view |
| Build and test (amd64, gcc12, openmpi) / Dev environment (Python) | ❌ failure | view |
Collaborator
|
How do this differ from CircuitCheck? |
sacpis
marked this pull request as draft
July 22, 2026 21:37
Collaborator
Author
This is a WIP. It is going to change. In short, CircuitCheck is the equivalence primitive, and the Validation Core is the safe optimization harness built on top of it. Basically CircuitCheck answers "are these two circuits equal?", whereas the Validation core answers "is this candidate a safe, non-regressing improvement?" and can't be fooled by an optimizer trying to game it. |
sacpis
force-pushed
the
co_ot_validation_core
branch
from
July 23, 2026 15:40
4d2230c to
a37199f
Compare
sacpis
marked this pull request as ready for review
July 23, 2026 22:59
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
…er into OptAnalysis Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
…nd seeded corpus Signed-off-by: Sachin Pisal <spisal@nvidia.com>
* adding a test suite for optimization validation Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
…ne-isolation test Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
…mping, preset seed sets) Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
…nse bound Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
sacpis
force-pushed
the
co_ot_validation_core
branch
from
July 27, 2026 16:39
a1bfb74 to
27e1b86
Compare
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
…arty code Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
1tnguyen
reviewed
Aug 5, 2026
1tnguyen
reviewed
Aug 5, 2026
…antum ops Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
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.
Goal
An independent correctness oracle for CUDA-Q compiler optimizations. Given a baseline and a candidate pass/pipeline, it decides (without a simulator or target) whether the candidate preserves the circuit's meaning, and reports resource metrics (gate/two-qubit/T counts, depth). It's built for the automated improvement pipeline, where untrusted agents propose pass changes and something they can't influence has to accept or reject them.
It fails closed: anything outside the supported domain (measurement, reset, dynamic control flow, too many qubits) is rejected, never silently passed. It also verifies the IR at every stage boundary, so a broken candidate gets caught and categorized instead of slipping through.
How it decides equivalence
Builds the exact unitary of each circuit straight from the IR and compares them (element-wise and up-to-global-phase). I think this is the safest check for small circuits. The result also advertises an oracle roadmap naming the tiers we'll add next like Clifford/tableau for scaling, density-matrix for mixed states, statevector as advisory-only.
The oracle is a plug-in point too. DenseUnitaryOracle is the built-in one, but you can pass your own Oracle for a fast optimization loop. Each in-domain case also reports the invariants it checked (equivalence, determinism, fixed-point).
Metrics
The core reports the metric tuple and each predicate outcome, but never a single weighted reward. That reduction is the caller's objective, on the untrusted side, since a weighted score is exactly what an optimizer could game. Metrics are either gating (a violated predicate fails the case) or informational (reported but doesn't fail it).
Usage
CLI (agents / CI):
It emits JSON and its exit code is the category
0 -> pass
1 -> invariant-failure
2 -> unsupported-domain
3 -> invalid-request
4 -> infrastructure-failure
Python:
The input is target-shaped. A PipelineTarget for the baseline, with the candidate injected via .with_pipeline(...), so a future CompileTarget binding can slot in without breaking the API.
It never raises. Failures is obtained from result.status
There's also validate_artifacts(...) for the case where you've already compiled the candidate yourself (out-of-process) and just want the compare + metrics on the two modules, so a crashing candidate compile can't take down the validator.
Benchmark
GHZ (H + full n-CX chain), two kernels compared through
compareTableaux, Used the same binary, just flipped the inverse argument.Note
This is a working prototype. Some of the hardening is in already (IR verification at stage boundaries, the invariants, and reproducible corpora with pinned seeds plus a small canonical set ported from OpenQASM). What's still missing for the hardened acceptance gate is frozen schemas, subprocess sandboxing wired end-to-end, the regression corpora, and canonical CI. Will have follow up commits in this PR.