Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable list[T] argument specification in kernel builder #1370

Merged
merged 6 commits into from
Mar 13, 2024

Conversation

amccaskey
Copy link
Collaborator

@amccaskey amccaskey commented Mar 12, 2024

We now require argument annotations with the Python language kernels, and lists must have element type specified (e.g. list[float] instead of just list).

Users likely will try to specify list element types with the kernel builder as well, but this currently emits an error

import cudaq 
kernel, thetas = cudaq.make_kernel(list[float])
print(kernel)
RuntimeError: error: Can not handle conversion of python type list[float] to MLIR type.

Offending code:
  File "/workspaces/cuda-quantum/builds/gcc-12-debug/test.py", line 3, in <module>
    kernel, thetas = cudaq.make_kernel(list[float])

This PR fixes this by enabling element type inference for kernel builder list arguments.

Copy link

copy-pr-bot bot commented Mar 12, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@amccaskey
Copy link
Collaborator Author

amccaskey commented Mar 12, 2024

/ok to test

Command Bot: Processing...

@amccaskey amccaskey requested a review from bmhowe23 March 12, 2024 00:12
@amccaskey amccaskey enabled auto-merge (squash) March 12, 2024 00:18
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Mar 12, 2024
Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Alex. LGTM, but could we add some tests to make sure we don't break it in the future? (I can create some and push to the PR if you prefer ... just let me know.)

python/cudaq/kernel/kernel_builder.py Show resolved Hide resolved
@amccaskey
Copy link
Collaborator Author

Thanks, Alex. LGTM, but could we add some tests to make sure we don't break it in the future? (I can create some and push to the PR if you prefer ... just let me know.)

Thanks Ben. I appreciate your offer to help - it would be very helpful if you were able to do so.

Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
@amccaskey
Copy link
Collaborator Author

Thanks, Alex. LGTM, but could we add some tests to make sure we don't break it in the future? (I can create some and push to the PR if you prefer ... just let me know.)

Thanks Ben. I appreciate your offer to help - it would be very helpful if you were able to do so.

Test added.

@amccaskey
Copy link
Collaborator Author

amccaskey commented Mar 12, 2024

/ok to test

Command Bot: Processing...

1 similar comment
@amccaskey
Copy link
Collaborator Author

amccaskey commented Mar 12, 2024

/ok to test

Command Bot: Processing...

Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Mar 13, 2024
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
@amccaskey
Copy link
Collaborator Author

amccaskey commented Mar 13, 2024

/ok to test

Command Bot: Processing...

Copy link
Collaborator

@bmhowe23 bmhowe23 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
Signed-off-by: Alex McCaskey <amccaskey@nvidia.com>
@amccaskey
Copy link
Collaborator Author

amccaskey commented Mar 13, 2024

/ok to test

Command Bot: Processing...

github-actions bot pushed a commit that referenced this pull request Mar 13, 2024
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Mar 13, 2024
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@amccaskey amccaskey merged commit 341d4a8 into NVIDIA:main Mar 13, 2024
133 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Mar 13, 2024
@bettinaheim bettinaheim changed the title Fix bug - enable list[T] argument specification with kernel builder Enable list[T] argument specification in kernel builder Apr 17, 2024
@bettinaheim bettinaheim added the bug fix To be listed under Bug Fixes in the release notes label Apr 17, 2024
@bettinaheim bettinaheim added this to the release 0.7.1 milestone Apr 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fix To be listed under Bug Fixes in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants