-
Notifications
You must be signed in to change notification settings - Fork 169
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
[NVQC] Support direct kernel invocation with a return value #1969
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an RFC someplace for this that scopes out the work, esp. the limitations?
runtime/cudaq/platform/default/rest_server/helpers/RestRemoteServer.cpp
Outdated
Show resolved
Hide resolved
runtime/cudaq/platform/default/rest_server/helpers/RestRemoteServer.cpp
Outdated
Show resolved
Hide resolved
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
…erver.cpp Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
…erver.cpp Co-authored-by: Eric Schweitz <eschweitz@nvidia.com>
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a good improvement to me, and it would be nice to be able to close the associated issue, so I'm in favor of putting this into the release.
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. Thanks, Thien!
CUDA Quantum Docs Bot: A preview of the documentation can be found here. |
Description
For MLIR-based kernels, the kernel launch is bootstrapped; hence technically we can pack the return value back to users.
This PR enables that:
Add a flat-buffer in
ExecutionContext
to store this data.Server side: introspect the entry-point kernel IR to know what type is being return. In this PR, only simple data types (float/int/bool) are supported.
Client side: check if buffer data is being returned from the server and the kernel launch is expecting some return value (via the return offset). If so, copy the data to return to users.
Adds tests for supported return types.
Compatibility
This is not a breaking change.
When both the client and service are updated, the return value will be available. Otherwise, no return value would be available (same as the existing behavior)
New client - old service: the service won't populate the buffer field in the return JSON.
Old client - new service: the buffer field in the return JSON would be dropped/ignored by the client.
Resolved #1597