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

[CircuitCheck] Handle local qubits #190

Merged
merged 1 commit into from
May 25, 2023

Conversation

boschmitt
Copy link
Collaborator

Description

This PR allows CircuitCheck to verify decompositions that require ancillary qubits. It does this by treating local allocations as ancillas. For example:

// It treat args as non-ancilla
func.func @cccz(%arg0: !quake.ref, %arg1: !quake.ref, %arg2: !quake.ref, %arg3: !quake.ref) {
  %0 = quake.alloca !quake.ref // It will treat it as an ancilla
  //...
}

The resulting unitary for the above circuit will only have 3 qubits (the arguments). CircuitCheck will also check if the ancilla(s) qubit(s) are properly cleaned up, i.e., intermediate results were uncomputed.

@boschmitt boschmitt force-pushed the circuitcheck-handle-local-qubits branch from 1e8bd5b to 8da8d42 Compare May 24, 2023 14:03
Copy link
Collaborator

@schweitzpgi schweitzpgi left a comment

Choose a reason for hiding this comment

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

LGTM. I believe we use std::size_t in the rest of the code base.

utils/CircuitCheck/UnitaryBuilder.cpp Outdated Show resolved Hide resolved
utils/CircuitCheck/UnitaryBuilder.cpp Outdated Show resolved Hide resolved
@boschmitt boschmitt force-pushed the circuitcheck-handle-local-qubits branch from 8da8d42 to cac1597 Compare May 25, 2023 07:54
@boschmitt boschmitt enabled auto-merge (squash) May 25, 2023 07:55
@boschmitt boschmitt merged commit 173b9f1 into NVIDIA:main May 25, 2023
@github-actions github-actions bot locked and limited conversation to collaborators May 25, 2023
@bettinaheim bettinaheim added the release notes Changes need to be captured in the release notes label Jun 28, 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.

4 participants