Skip to content
This repository was archived by the owner on Jan 12, 2024. It is now read-only.
This repository was archived by the owner on Jan 12, 2024. It is now read-only.

QIR simulator should check result of qubit Release #552

@swernli

Description

@swernli

Our existing C# wrapper for the fullstate simulator checks the result of release on a qubit to ensure that the qubit was in a well-known state at release time (see #206 for the detailed discussion of the release semantics). Releasing a qubit that could be entangled can result in problems for the rest of the program, and the simulator gives developers a way to use Q# to validate their algorithms for this. The C++ wrapper around the simulator used in QIR does not check the return of release and therefore doesn't provide this feedback, allowing for algorithms to effectively leak state.

To test this, consider the following Q#:

operation Test() : Unit {
    use q = Qubit();
    X(q);
}

Because the qubit is not in the ground state and hasn't been measured, running this code on the C# simulator will result in a ReleasedQubitsAreNotInZeroState exception being thrown from QubitManager.cs. We need an equivalent check in the QIR fullstate simulator wrapper.

@bettinaheim @cgranade FYI

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions