Skip to content

Commit

Permalink
Add support for delay instruction
Browse files Browse the repository at this point in the history
This is made possible by a temporary fork of qiskit-qir.
Discussions to add the delay instruction to the upstream repo (or to
let the user define custom translation rules) are engaged in
microsoft/qiskit-qir#40
  • Loading branch information
Julien Dumazert authored and jrj-d committed May 19, 2023
1 parent 85c604b commit 22f34d4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ requires-python = ">=3.7"
dependencies = [
"requests",
"qiskit-terra",
"qiskit-qir @ git+https://github.com/microsoft/qiskit-qir"
"qiskit-qir @ git+https://github.com/jrj-d/qiskit-qir@add_delay_instruction_using_an_extern"
]

[project.optional-dependencies]
Expand Down
15 changes: 15 additions & 0 deletions tests/test_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from requests_mock.mocker import Mocker

from qiskit_alice_bob_provider.api.client import AliceBobApiException
from qiskit_alice_bob_provider.backend import _qiskit_to_qir
from qiskit_alice_bob_provider.provider import AliceBobProvider


Expand Down Expand Up @@ -111,3 +112,17 @@ def test_failed_server_side_validation(failed_validation_job: Mocker) -> None:
backend = provider.get_backend('SINGLE_CAT_SIMULATOR')
with pytest.raises(AliceBobApiException):
execute(c, backend)


def test_delay_instruction_recognized() -> None:
c = QuantumCircuit(1, 2)
c.initialize('+', 0)
c.measure_x(0, 0)
c.delay(3000, 0, unit='ns')
c.measure(0, 1)
qir = _qiskit_to_qir(c)
delay_call = (
'call void @__quantum__qis__delay__body'
'(double 3.000000e+00, %Qubit* null)'
)
assert delay_call in qir

0 comments on commit 22f34d4

Please sign in to comment.