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

New: Limited support for barriers #12

Merged
merged 1 commit into from
Jul 26, 2021
Merged

Conversation

ameyer-rigetti
Copy link
Contributor

@ameyer-rigetti ameyer-rigetti commented Jul 20, 2021

For QASM barriers affecting all qubits, replace with an empty Quil PRESERVE_BLOCK. Otherwise, omit.

Closes #7

@ameyer-rigetti ameyer-rigetti self-assigned this Jul 20, 2021
@ameyer-rigetti ameyer-rigetti force-pushed the 7-barrier-support branch 2 times, most recently from 020e2d4 to 4a0d542 Compare July 20, 2021 00:59
@@ -28,17 +28,6 @@
from ._qcs_job import RigettiQCSJob


def _remove_barriers(circuit: QuantumCircuit) -> None:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Barrier handling has been moved into the RigettiQCSJob class, as there's no straightforward way to replace the instruction with a pragma here

def test_init__circuit_with_barrier__qubit_subset(backend: RigettiQCSBackend, mocker: MockerFixture):
circuit = QuilCircuit(QuantumRegister(2, "q"), ClassicalRegister(2, "ro"))
circuit.h(0)
circuit.barrier(0)
Copy link
Contributor Author

@ameyer-rigetti ameyer-rigetti Jul 20, 2021

Choose a reason for hiding this comment

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

Note that for now, we're taking a naive approach and only "translating" barriers applied to all qubits -- even if it might still be possible to translate it with some deeper/more complex analysis (like in this example, since the only qubit involved is q0).

qiskit_rigetti/_qcs_job.py Show resolved Hide resolved
qiskit_rigetti/_qcs_job.py Show resolved Hide resolved
qiskit_rigetti/_qcs_job.py Outdated Show resolved Hide resolved
qiskit_rigetti/hooks/pre_compilation.py Show resolved Hide resolved
qiskit_rigetti/_qcs_job.py Show resolved Hide resolved
@ameyer-rigetti ameyer-rigetti force-pushed the 7-barrier-support branch 2 times, most recently from 10a163a to 7b00a98 Compare July 20, 2021 17:18
):
make_job(backend, circuit, qc)

program: Program = quil_to_native_quil_spy.call_args[0][0]
Copy link
Contributor

Choose a reason for hiding this comment

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

subterfuge!

Copy link
Contributor

@notmgsk notmgsk left a comment

Choose a reason for hiding this comment

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

LGTM! Smash that merge button.

@ameyer-rigetti ameyer-rigetti merged commit 33ac2e7 into main Jul 26, 2021
@ameyer-rigetti ameyer-rigetti deleted the 7-barrier-support branch July 26, 2021 19:03
@rigetti-githubbot
Copy link

🎉 This PR is included in version 0.4.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support QASM barriers
3 participants