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

Support verbatim boxes in from_ir #972

Open
speller26 opened this issue May 9, 2024 · 0 comments
Open

Support verbatim boxes in from_ir #972

speller26 opened this issue May 9, 2024 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@speller26
Copy link
Member

speller26 commented May 9, 2024

Describe the feature you'd like
Right now, verbatim boxes are ignored altogether when translating OpenQASM to Circuit objects via the Circuit.from_ir method:

from braket.circuits import Circuit

oq = """
OPENQASM 3.0;
#pragma braket verbatim
box {
  h $0;
  cnot $0, $1;
}
"""
Circuit.from_ir(oq)
T  : │  0  │  1  │
      ┌───┐       
q0 : ─┤ H ├───●───
      └───┘   │   
            ┌─┴─┐ 
q1 : ───────┤ X ├─
            └───┘ 
T  : │  0  │  1  │

Verbatim boxes need to be supported for faithful translation of OpenQASM, particularly for programs with both verbatim and non-verbatim components.

Note: Implementing this feature will require expanding the OpenQASM parsing functionality in the default simulator package.

How would this feature be used? Please describe.
As mentioned above, this would allow OpenQASM programs with verbatim boxes to be translated correctly.

Describe alternatives you've considered
Entirely verbatim circuits, can be wrapped manually

verbatim_circuit = Circuit().add_verbatim_box(Circuit.from_ir(openqasm))

but this fails for programs with verbatim boxes in between non-verbatim instructions.

@speller26 speller26 added the enhancement New feature or request label May 9, 2024
@rmshaffer rmshaffer added the good first issue Good for newcomers label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants