Skip to content

Commit

Permalink
add qir releasenotes
Browse files Browse the repository at this point in the history
  • Loading branch information
thisac committed Jul 18, 2023
1 parent 74dfbd2 commit 68d42d9
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions releasenotes/notes/feature-qir-compiler-58332c0019b51ae4.yaml
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 68d42d9

Please sign in to comment.