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 one to progressively build a Kernel with the kernel_builder #558

Merged
merged 7 commits into from
Aug 17, 2023

Conversation

amccaskey
Copy link
Collaborator

Setup kernel_builder to start the wrapped FuncOp with a ReturnOp instead of manually adding one at either to_quake or jitCode, and set the insertion point to right before that terminator.

With this change, and smarter caching of the wrapped ExecutionEngine, the kernel_builder can be more flexible and allow progressive building / checking of the internal Quake code.

auto kernel = cudaq::make_kernel();
auto q = kernel.qalloc(2);
kernel.h(q[0]);

// check the kernel as-is
auto state = cudaq::get_state(kernel);
auto counts = cudaq::sample(kernel);

// Continue building the kernel
kernel.x<cudaq::ctrl>(q[0], q[1]);
state = cudaq::get_state(kernel);
counts = cudaq::sample(kernel);

Previously, this would lead to seg-faults or MLIR errors.

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

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

cuda-quantum-bot added a commit that referenced this pull request Aug 17, 2023
@amccaskey amccaskey merged commit d47440e into NVIDIA:main Aug 17, 2023
101 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 17, 2023
@amccaskey amccaskey deleted the progressiveBuilder branch September 13, 2023 23:09
@bettinaheim bettinaheim added this to the release 0.4.1 milestone Sep 27, 2023
@bettinaheim bettinaheim added the release notes Changes need to be captured in the release notes label Sep 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release notes Changes need to be captured in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants