From 68d42d90e1f2707a2bf59bd15118396220694850 Mon Sep 17 00:00:00 2001 From: Theodor Isacsson Date: Tue, 18 Jul 2023 10:38:52 -0700 Subject: [PATCH] add qir releasenotes --- ...feature-qir-compiler-58332c0019b51ae4.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 releasenotes/notes/feature-qir-compiler-58332c0019b51ae4.yaml diff --git a/releasenotes/notes/feature-qir-compiler-58332c0019b51ae4.yaml b/releasenotes/notes/feature-qir-compiler-58332c0019b51ae4.yaml new file mode 100644 index 0000000..1e72c37 --- /dev/null +++ b/releasenotes/notes/feature-qir-compiler-58332c0019b51ae4.yaml @@ -0,0 +1,53 @@ +--- +features: + - | + Adds support for compiling circuits into the Quantum Intermediate Representation (QIR) + language using PyQIR API and qirlib LLVM wrapper. + + .. code-block:: python + + circuit = Circuit(2) + + with circuit.context as reg: + ops.X(reg.q[0]) + ops.Y(reg.q[1]) + + qir_string = circuit.to_qir() + + Circuits can also be compiled directly into bitcode. + + .. code-block:: python + + qir_string = circuit.to_qir(bitcode=True) + + - | + Adds a Quantum Intermediate Representation (QIR) loader which consumes a QIR script and returns + a corresponding circuit containing the same instruction. + + .. code-block:: + + ; ModuleID = 'Citrus' + source_filename = "Citrus" + + %Qubit = type opaque + + define void @main() { + entry: + call void @__quantum__rt__initialize(i8* null) + call void @__quantum__qis__x__body(%Qubit* null) + call void @__quantum__qis__y__body(%Qubit* inttoptr (i64 1 to %Qubit*)) + ret void + } + + declare void @__quantum__rt__initialize(i8*) + declare void @__quantum__qis__x__body(%Qubit*) + declare void @__quantum__qis__y__body(%Qubit*) + + The above QIR script can be loaded into a dwave-gate circuit using the + ``dwave.gate.qir.loader.load_qir_string`` function. + + .. code-block:: python + + from dwave.gate.qir.loader import load_qir_string + + circuit = load_qir_string(qir_string, circuit=circuit) \ No newline at end of file