The tracer should not work on the presence of measurements.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 1.1k
- Forks
- 456
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 165
Description
Required prerequisites
- Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
- Make sure you've read the documentation. Your issue may be addressed there.
- Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
- If possible, make a PR with a failing test to give us a starting point to work on!
Describe the bug
When tracing the circuit, the execution manager gathers the quantum operations without executing them, i.e., the process does not do any sort of simulation. This behavior work well for all operations that do not return need to return values; however it gives misleading/wrong results in the case of measurements.
The current behavior is to always return 0 as the result of measurement:
https://github.com/NVIDIA/cuda-quantum/blob/99b58fda0007540fab23e6f80021ddba2d235fa3/runtime/cudaq/qis/managers/BasicExecutionManager.h#L251-L253
Steps to reproduce the bug
Using any functionality that relies on the tracer, e.g., cudaq::estimate_resources, might return misleading/wrong results if the target kernels relies on measurements---specifically those that further process those measurements results, e.g., using them on conditions.
Expected behavior
When running the tracer, an error (or at least a warning) should be emitted if the kernel contain measurements.
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
- CUDA Quantum version: main branch
Suggestions
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with runtime/cudaq/qis/managers/BasicExecutionManager.h at the cited measurement handling around lines 251-253, then trace how cudaq::estimate_resources uses the execution manager. Reproduce the behavior with a kernel whose measurement result controls a condition. Done means tracing emits an error or warning instead of silently returning 0 for measurements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- quantum-computing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100