[core] Fix some more memtoreg issues. - #5293
Conversation
schweitzpgi
commented
Aug 26, 2026
- regressions in handling classical values discovered and fixed
- add a canonical ordering to arguments appending
- add missing guards that resulted in crashes
- add new regression tests
|
Fixes #5286 |
6aa8ec8 to
8e937a5
Compare
sacpis
left a comment
There was a problem hiding this comment.
Thanks @schweitzpgi. Left few comments.
CI Summary (
|
| Job | Result |
|---|---|
binaries |
⏩ skipped |
build_and_test |
✅ success |
changes |
✅ 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 (43) — 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 |
| Check for stable CUDA-Q changes | ✅ success | 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 |
There was a problem hiding this comment.
Thanks, @schweitzpgi for the updates!
I tested the failing test on my branch with this change, and it is working.
nvq++ --target quantinuum --emulate ../targettests/execution/estimate_resources_break.cpp && ./a.out
Total # of gates: 32, total # of qubits: 1, circuit depth: 32, multi-Q gate count: 0, multi-Q depth: 0
{
reset : 10
mz : 10
x : 11
h : 1
}
khalatepradnya
left a comment
There was a problem hiding this comment.
Is it possible to enable the test in issue #5286?
cuda-quantum/targettests/execution/estimate_resources_break.cpp
Lines 11 to 12 in 76213fb
Let me check... |
It looks like this was disabled because of how long it took it CI. I won't mess with it in this PR. That's an unrelated issue. |
- regressions in handling classical values discovered and fixed - add a canonical ordering to arguments appending - add missing guards that resulted in crashes - add new regression tests Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
c877d41 to
17bef63
Compare
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
It passed in the latest CI (Ref: logs) I have pushed a commit to enable it. |
There was a problem hiding this comment.
I've found a regression from main in a simple test case with a quantum and classical variable:
func.func @min(%c: i1, %k: i32) {
%q = quake.alloca !quake.ref
%m = cc.alloca i32
cc.if (%c) {
%v = cc.load %m : !cc.ptr<i32>
cc.store %k, %m : !cc.ptr<i32>
quake.x %q : (!quake.ref) -> ()
}
quake.y %q : (!quake.ref) -> ()
%f = cc.load %m : !cc.ptr<i32>
quake.log_output %f : (i32) -> () {compilerGenerated}
quake.dealloc %q : !quake.ref
return
}
With cudaq-opt --memtoreg fails with
test.qke:4:3: error: 'cc.if' op along control flow edge from Operation cc.continue to parent: successor operand type #0 '!quake.wire' should match successor input type #0 'i32'
cc.if (%c) {
^
test.qke:4:3: note: see current operation:
%2:2 = "cc.if"(%arg0, %0) ({
^bb0(%arg3: !quake.wire):
%4 = "quake.x"(%arg3) <{operandSegmentSizes = array<i32: 0, 0, 1>}> : (!quake.wire) -> !quake.wire
"cc.continue"(%4, %arg1) : (!quake.wire, i32) -> ()
}, {
^bb0(%arg2: !quake.wire):
"cc.continue"(%arg2, %1) : (!quake.wire, i32) -> ()
}) : (i1, !quake.wire) -> (i32, !quake.wire)
test.qke:4:3: note: region branch point
This works on main.
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
|
BTW, the root cause here was that To fix this issue, we did reorder liveOutSet (and rebuild liveInArgs) to the canonical order, so results, terminator operands, and block arguments share one order. Also, dropped both sorts and the |
CI Summary (
|
| Job | Result |
|---|---|
binaries |
⏩ skipped |
build_and_test |
✅ success |
changes |
✅ success |
config_devdeps |
✅ success |
config_source_build |
⏩ skipped |
config_wheeldeps |
⏩ skipped |
devdeps |
✅ success |
docker_image |
⏩ skipped |
gen_code_coverage |
⏩ skipped |
metadata |
✅ success |
python_metapackages |
⏩ skipped |
python_wheels |
⏩ skipped |
source_build |
⏩ skipped |
wheeldeps |
⏩ skipped |
⏩ Skipped jobs (9) — intentionally skipped on PR builds; run on merge_group / workflow_dispatch
| Job |
|---|
binaries |
config_source_build |
config_wheeldeps |
docker_image |
gen_code_coverage |
python_metapackages |
python_wheels |
source_build |
wheeldeps |
All sub-jobs (24) — every matrix leg, with links
| Job | 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 |
| CI Summary | ❔ in_progress | view |
| Check for stable CUDA-Q changes | ✅ success | view |
| Configure build (devdeps) | ✅ success | view |
| Configure build (source_build) | ⏩ skipped | view |
| Configure build (wheeldeps) | ⏩ skipped | 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, llvm) / Caching | ✅ success | view |
| Load dependencies (amd64, llvm) / Finalize | ✅ success | view |
| Load dependencies (amd64, llvm) / 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 | ⏩ skipped | view |
| Prepare cache clean-up | ✅ success | view |
| Retrieve PR info | ✅ success | view |
✅ Required checks (4/4) — declared in .github/required-checks.yml for merge_group_fast
| 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 |