[DNM] Adopt cudaq::measure_handle#528
Draft
khalatepradnya wants to merge 12 commits into
Draft
Conversation
…syndromes to vector<bool>
CUDA-Q PR #4409 (`pkhalate/measure-handle-pr3b-cpp-frontend`) is the
first source-breaking change in the `measure_result` -> `measure_handle`
migration. Bring CUDA-QX in alignment.
Changes:
- `.cudaq_version` -> `2914390720` (PR 3b head).
- `enqueue_syndromes` signature: `std::vector<cudaq::measure_result>` ->
`std::vector<bool>` in `decoding.h` plus the two device-side
implementations. The replay-mode caller in
`surface_code-1.cpp:787` previously constructed
`cudaq::measure_result(uint8_t)` from raw saved syndrome bits; the
Option C alias in CUDA-Q rebinds `measure_result` to `measure_handle`,
which has no `int` constructor by design (handles carry measurement
identity, not values). The cleanest resolution is to acknowledge that
what crosses the host-device boundary in this API is a sequence of
syndrome *bits*, not measurement events.
- `__qpu__` callers in `surface_code-{1,2,3}.cpp` and
`real_time_complete.cpp` wrap their handle vectors with
`cudaq::to_bools(...)` at the call site (preserving handle storage
shape inside the kernel; explicit discrimination at the API edge).
- `to_integer(mz(...))` sites in `surface_code-1.cpp:438`,
`surface_code-2.cpp:325`, and `real_time_complete.cpp:125` updated
to `cudaq::to_integer(cudaq::to_bools(mz(...)))` to match PR 3b's
`[bridge] Reject to_integer(mz(...))` rule.
Local sanity:
- `cmake -DCUDAQX_ENABLE_LIBS=qec -DCUDAQX_INCLUDE_TESTS=OFF` qec
library builds clean against installed CUDA-Q from PR 3b head. All 6
device .o files (`repetition_device`, `steane_device`,
`surface_code_device`, `memory_circuit`, `quantinuum_device`,
`simulation_device`) link.
- `nvq++ -fsyntax-only` on `surface_code-{1,2,3}.cpp` and
`real_time_complete.cpp` succeeds end to end.
- TESTS=ON build is blocked locally on TensorRT, so the test-app
link/run path is verified by CI.
- Pre-existing `dem_sampling_gpu.cpp` cuStabilizer link errors are
unrelated.
Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
bmhowe23
reviewed
May 3, 2026
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
Collaborator
Author
|
/ok to test bdfb537 |
…_test API Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
Fix for error seen in CI RuntimeError: Failed to locate init function 'function_enqueue_syndromes.<...>IbSaIbEEm.init_func' in decoder library at libcudaq-qec-realtime-decoding-simulation.so Update the string to match. `enqueue_syndromes_test` is intentionally not added to the list: it is only used by the C++ host-side replay path, which does not go through the dlopen/dlclose reload cycle this loader defends against. Co-authored-by: Cursor <cursoragent@cursor.com> Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
* Needs LLVM 22 update! Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
khalatepradnya
commented
May 12, 2026
| "cudaq": { | ||
| "repository": "NVIDIA/cuda-quantum", | ||
| "ref": "e47b30b4d50385b97284fb124f33d3e370107fb2" | ||
| "ref": "bb93f26df2ccb5300190318425dc08bd52b60e2e" |
Collaborator
Author
There was a problem hiding this comment.
This currently pointing to my dev branch, but should be updated to CUDA-Q commit ID once it is merged.
khalatepradnya
added a commit
to khalatepradnya/cuda-quantum
that referenced
this pull request
May 13, 2026
…ures A callable parameter's signature is a device-side type contract for the callable's body, not a slot for a handle value: the host marshals only the function-pointer payload, and any handle the callable produces or consumes lives entirely on the device side. PR 3b previously gated the entry-point boundary classifier with `includeCallables=true`, which walked into callable signatures and rejected `qkernel<vector<measure_handle>(...)>` parameters even though no handle ever crossed the boundary as data. `cudaq::cc::containsMeasureHandle` now stops at callable / FunctionType boundaries, matching what the marshalling layer (Marshal.cpp:776/779) already did with the default. The `includeCallables` knob had zero non-default consumers and is removed. Surfaced by the cudaqx QEC companion (NVIDIA/cudaqx#528): stabilizer- round callbacks declared `qkernel<vector<measure_handle>(patch, ...)>` are passed as parameters to entry-point kernels (memory_circuit_mz), where they are invoked entirely on device. Tests: - test/AST-Quake/measure_handle.cpp: positive lowering coverage for callable parameters whose signatures mention measure_handle (both return-handle and take-handle shapes); kernel is marked `cudaq-entrypoint`, not silently demoted. - test/AST-error/measure_handle.cpp: removed the two callable-shape rejection cases (BoundaryFunctionTypeParam, BoundaryQkernelParam). Existing data-shape rejection cases (vector / tuple / aggregate / pointer / reference) cover the negative side and remain. Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
Aligns the companion PR with the rebased PR 3c head
(f0aa11751c on pkhalate/measure-handle-pr3c-python-frontend),
which carries:
- PR 3b A1 follow-up: relaxed entry-point boundary check so
`qkernel<vector<measure_handle>(...)>` callable parameters
are admissible (function-pointer payload, not handle data,
crosses the host-device boundary).
- PR 3c follow-up: matching Python `containsMeasureHandle`
relaxation.
Local verification: cudaq-qec library and
cudaq-qec_memory_circuit.o build clean against the new
cuda-quantum HEAD via cmake --install + ninja qec-only.
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
Signed-off-by: Pradnya Khalate <pkhalate@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.
measure_result->measure_handlemigration.