Skip to content

feature: add barrier instruction support#108

Merged
rmshaffer merged 5 commits into
mainfrom
rmshaffer/barrier
May 18, 2026
Merged

feature: add barrier instruction support#108
rmshaffer merged 5 commits into
mainfrom
rmshaffer/barrier

Conversation

@rmshaffer

Copy link
Copy Markdown
Member

Issue #, if available:

Description of changes:

Adds a barrier() instruction so that AutoQASM programs can emit OpenQASM barrier compiler directives, matching the Braket SDK's Circuit.barrier() instruction.

Testing done:

Merge Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your pull request.

General

Tests

  • I have added tests that prove my fix is effective or that my feature works (if appropriate)
  • I have checked that my tests are not configured for a specific region or account (if appropriate)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@rmshaffer rmshaffer requested a review from a team as a code owner May 8, 2026 20:50
@codecov

codecov Bot commented May 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (a962209) to head (217207b).

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #108   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           52        52           
  Lines         2279      2289   +10     
  Branches       266       265    -1     
=========================================
+ Hits          2279      2289   +10     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rmshaffer rmshaffer requested a review from aniksd-braket May 11, 2026 22:58
@rmshaffer rmshaffer merged commit 157e9fb into main May 18, 2026
18 checks passed
@rmshaffer rmshaffer deleted the rmshaffer/barrier branch May 18, 2026 20:58
def _as_qubit_iterable(
qubits: aq_types.QubitIdentifierType | Iterable[aq_types.QubitIdentifierType] | None,
default: Iterable[aq_types.QubitIdentifierType] | None = None,
) -> Iterable[aq_types.QubitIdentifierType]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nit: Since _as_qubit_iterable
can return a list or a GlobalQubitRegister, the return type is correct but could be more precise with Iterable[...] | GlobalQubitRegister

@rmshaffer rmshaffer May 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

GlobalQubitRegister is already a Iterable[aq_types.QubitIdentifierType], and the caller should only care that what comes back is an Iterable[aq_types.QubitIdentifierType]. I think the extra type hint would be redundant here.

However in general it's confusing that GlobalQubitRegister is both an oqpy.Qubit and an Iterable of qubits - leaking a bit of oqpy abstractions through here, will look for a way to clean this up.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

opened #110 to clean up the qubit-related types.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants