Commit d76451d
[docs] measuring_kernels: explicit vector<bool> return + to_bools
PR NVIDIA#4409 made MLIR-mode `mz(qview)` return
`std::vector<measure_handle>`, so `__qpu__ auto kernel2()` now
deduces a handle-bearing return. `Marshal.cpp::hasLegalType`
filters such kernels out of `GenKernelExecution`'s worklist, the
`.run` companion is never generated, and `cudaq::run(1000,
kernel2)` fails at runtime with `runnable kernel ... is not
present`.
Spell the return as `std::vector<bool>` and wrap `mz(q)` with
`cudaq::to_bools(...)` so the kernel signature stays in the
host-visible subset. Host-side `result[0]` is now a `bool` and
`static_cast<int>(result[0])` is well-defined; previously it
would have routed through `measure_handle::operator bool()`,
which `std::abort()`s in MLIR mode.
The `[Begin Run0]` / `[End Run0]` Sphinx literalinclude markers
are unchanged.
Signed-off-by: Pradnya Khalate <pkhalate@nvidia.com>
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 68a1f8f commit d76451d
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
0 commit comments