[python] Control sets cannot mix a qubit with a qview, and cudaq.control fails on kernels that call other kernels
Maintainers usually reply within 1 day
@schweitzpgi is already working on this.
Since Jul 8, 2026.
Assessment
This issue has not been assessed yet.
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.
Describe the feature
Two related gaps make "one external control qubit + an ancilla register"
control sets awkward in Python kernels:
- Gate level: any mix of a bare qubit and a
qviewin one control set is
rejected (invalid argument type for control operand). All-qubit and
single-view control sets work. - Kernel level:
cudaq.control(kernel, control, args...)works for leaf
kernels (including list arguments) but fails with "Could not
successfully apply kernel specialization" when the controlled kernel
itself calls another kernel — so composite operations cannot be
controlled wholesale.
import cudaq
cudaq.set_target("qpp-cpu")
# (1) mixed control set
@cudaq.kernel
def mixed():
c = cudaq.qubit()
q = cudaq.qvector(3)
x.ctrl(c, q.front(2), q[2]) # error: invalid argument type for control operand
# (2) cudaq.control of a composite kernel
@cudaq.kernel
def leaf(q: cudaq.qview):
for i in range(q.size()):
x(q[i])
@cudaq.kernel
def composite(q: cudaq.qview):
leaf(q)
@cudaq.kernel
def caller():
c = cudaq.qubit()
q = cudaq.qvector(2)
x(c)
cudaq.control(leaf, c, q) # OK
cudaq.control(composite, c, q) # RuntimeError: Could not successfully apply kernel specialization.
Workaround: co-allocate the control qubit and the ancillas in one register
and slice views (register.front(...)/register.back(...)) — but that
leaks into public APIs: users must co-allocate their control qubit with a
library's ancilla register instead of passing any qubit they own (e.g. a
QPE counting qubit). Either fixing (1) or (2) would remove the constraint;
(2) alone would allow cudaq.control(subroutine, ctrl, ...) over composite
operations.
Environment
- CUDA-Q built from source at commit
0be565550f4c23affdcbed9e4eaec38d2d0915e6 - Python 3.11.x, target
qpp-cpu(library mode) - AlmaLinux 8.10, x86_64
All reproducers below were executed and verified against this build.
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 508
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 100
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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.
More from NVIDIA/cuda-quantum
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
NVIDIA/cuda-quantum#6035 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 1-3 hours Newbie friendliness 77/100
NVIDIA/cuda-quantum#6034 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NVIDIA/cuda-quantum#6033 ·
Maintainers usually reply within 1 day
-
Point the CUDA-Q Pulse research preview docs to the released cudaq-pulse packagePossibly taken @fedonman claimed this 2 days ago. Open
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
NVIDIA/cuda-quantum#6031 ·
Maintainers usually reply within 1 day
-
Realtime fnv1a_hash sign-extends char, so a non-ASCII handler name gets a platform-dependent function idPossibly taken @fedonman claimed this 2 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
NVIDIA/cuda-quantum#6029 ·
Maintainers usually reply within 1 day
All issues in NVIDIA/cuda-quantum
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 2 days
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
ClickHouse/clickhouse-cpp#645 ·
Maintainers usually reply within 1 day
-
bug compatibility difficulty:easy prio:normal
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
NatronGitHub/openfx-misc#524 ·
Maintainers usually reply within 1 day
-
documentation enhancement help wanted P0
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Awesome-Embedded-Learning-Studio/Tutorial_AwesomeModernCPP#359 ·
Maintainers usually reply within 1 day
-
Type: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
openscad/openscad#7360 · 2 comments ·
Maintainers usually reply within 1 day