Skip to content

Deprecate builder ctrl gates that are not specification compliant - #935

Merged
anthony-santana merged 1 commit into
NVIDIA:mainfrom
anthony-santana:ctrl_gates
Nov 16, 2023
Merged

anthony-santana merged 1 commit into
NVIDIA:mainfrom
anthony-santana:ctrl_gates

Conversation

@anthony-santana

Copy link
Copy Markdown
Collaborator

Description

With (PR #876), we are now enforcing the use of cudaq::ctrl when a programmer intends to run a control gate. This behavior must be matched in the kernel builder to remain specification compliant.

As is, this deprecates the old functions with a stern warning, and replaces them with new templated versions. Depending on when this PR is merged, the deprecated functions should be removed for the following release cycle.

Note: this has no impact on the Python API, only the C++ kernel builder.

Old behavior that will now show a deprecation notice:

auto [kernel, value] = cudaq::make_kernel<float>();
std::vector<cudaq::QuakeValue> ctrls{kernel.qalloc(), kernel.qalloc()};
auto target = kernel.qalloc();

// Now deprecated:
kernel.x(ctrls, target);
kernel.x(value, ctrls, target);
kernel.rx(3.14, ctrls, target);

The preferred method moving forward is

kernel.x<cudaq::ctrl>(ctrls, target);
kernel.x<cudaq::ctrl>(value, ctrls, target);
kernel.rx<cudaq::ctrl>(3.14, ctrls, target);

@copy-pr-bot

copy-pr-bot Bot commented Nov 15, 2023

Copy link
Copy Markdown

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.

@anthony-santana

anthony-santana commented Nov 15, 2023 •

Copy link
Copy Markdown
Collaborator Author

/ok to test

Command Bot: Processing...

@schweitzpgi schweitzpgi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

🙌

Signed-off-by: A.M. Santana <anthonys@nvidia.com>
@anthony-santana

anthony-santana commented Nov 16, 2023 •

Copy link
Copy Markdown
Collaborator Author

/ok to test

Command Bot: Processing...

@anthony-santana
anthony-santana enabled auto-merge (squash) November 16, 2023 16:55
@anthony-santana
anthony-santana merged commit a323245 into NVIDIA:main Nov 16, 2023
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 16, 2023
@bettinaheim bettinaheim added this to the release 0.6.0 milestone Jan 22, 2024
@bettinaheim bettinaheim added the release notes Changes need to be captured in the release notes label Jan 22, 2024
@anthony-santana
anthony-santana deleted the ctrl_gates branch March 18, 2024 15:55
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