Add support for zip function inside kernels
Open
Nobody has claimed this yet.
python-lang
stale-notified
- 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
from cudaq import spin
from typing import List
cudaq.set_target('qpp-cpu')
@cudaq.kernel
def kernel(c: List[int], t: List[int]):
q = cudaq.qvector(5)
for i, j in zip(c, t):
cx(q[i], q[j])
cs = [0,1,2,3]
ts = [1,2,3,4]
hamiltonian = spin.x(0)
results = cudaq.observe(kernel, hamiltonian, cs, ts)
CompilerError: 33529107.py:12: error: unhandled function call - zip, known kernels are dict_keys(['kernel'])
(offending source -> zip(c, t))
Steps to reproduce the bug
NA
Expected behavior
Can we support the zip function?
Is this a regression? If it is, put the last known working version (or commit) here.
Not a regression
Environment
na
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 by reproducing the reported cudaq.kernel example with zip(c, t), qvector, and cudaq.observe, then trace the compiler path that emits the “unhandled function call - zip” error. Identify the kernel-supported function handling and its existing tests, if any. Done means the example compiles and runs with zip over the two kernel arguments without the reported compiler error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100