Skip to content

OpenQASM3 Frontend#2842

Merged
natestemen merged 9 commits into
unitaryfoundation:mainfrom
ACE07-Sev:openqasm-frontend
Dec 3, 2025
Merged

OpenQASM3 Frontend#2842
natestemen merged 9 commits into
unitaryfoundation:mainfrom
ACE07-Sev:openqasm-frontend

Conversation

@ACE07-Sev
Copy link
Copy Markdown
Contributor

Description

Initial commit to tackle #1503


License

  • I license this contribution under the terms of the GNU GPL, version 3 and grant Unitary Foundation the right to provide additional permissions as described in section 7 of the GNU GPL, version 3.

Before opening the PR, please ensure you have completed the following where appropriate.

@ACE07-Sev
Copy link
Copy Markdown
Contributor Author

In this one I believe only mitiq/pec has some failures which is exactly the same as the #2839 case (mitigated error being exactly the same as unmitigated). Besides that, openqasm3.ast.Program (the datatype for OpenQASM3's circuit afaik) has some issues with mypy.

Besides these, should be fine. Kindly have a look and let me know if there are any thoughts :) .

Copy link
Copy Markdown
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Awesome start! A few high level comments to align on before we get into the weeds.

Comment thread mitiq/interface/mitiq_openqasm/conversions.py Outdated
Comment thread mitiq/interface/conversions.py Outdated
Comment thread mitiq/interface/mitiq_openqasm/conversions.py Outdated
@ACE07-Sev ACE07-Sev mentioned this pull request Nov 2, 2025
Comment thread mitiq/executor/executor.py Outdated
@natestemen natestemen self-requested a review November 14, 2025 17:40
@ACE07-Sev ACE07-Sev changed the title - Initial commit to add frontend for OpenQASM3. OpenQASM3 Frontend Nov 16, 2025
@ACE07-Sev
Copy link
Copy Markdown
Contributor Author

@natestemen Greetings,

Hope you're doing well. Anything I need to do for this PR?

Copy link
Copy Markdown
Collaborator

@b-goldsmith b-goldsmith left a comment

Choose a reason for hiding this comment

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

Doing a search to see where the other frontends are included in the code...

@ACE07-Sev while I see test cases added for openqasm in the existing test files, I do not see specific openqasm test cases. The other frontends in mitiq/interface/mitiq_* include a tests folder with specific use cases. We should be testing things for openqasm, like confirming expected behavior when an invalid string is provided.

mitiq/README.md includes a Supported frontends section that should be updated.
image

In docs/source/apidoc.md there is an Interface section that includes the other frontends.

As a reminder, we should create an issue to include an example of ZNE with OpenQASM3. Once that is completed the docs/source/guide/frontends-backends.md can be updated with a link like the other frontends.

@ACE07-Sev
Copy link
Copy Markdown
Contributor Author

Greetings Brian,

Hope you're doing well. Thank you for the review!

@ACE07-Sev while I see test cases added for openqasm in the existing test files, I do not see specific openqasm test cases. The other frontends in mitiq/interface/mitiq_* include a tests folder with specific use cases. We should be testing things for openqasm, like confirming expected behavior when an invalid string is provided.

I'd appreciate giving me a list of items to write testers for. I can't really use other interfaces as an example since they differ significantly from one another.

The other items you mentioned seem to be the doc parts which I'll add now.

@ACE07-Sev
Copy link
Copy Markdown
Contributor Author

@bdg221 OpenQASM doesn't have a logo apparently. What image should I use?

Copy link
Copy Markdown
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

Looking good, but a few individual unit tests demonstrating basic circuit conversions would be useful, and we need to sort out the type of object we expect from users. I think str is the most user-friendly, but I'm not sure that would work in the current state.

Thanks for your continued work here!

Comment thread docs/source/apidoc.md
Comment thread mitiq/interface/conversions.py
Comment thread mitiq/interface/utils.py Outdated
- Added tester for above.
- Removed #TODO tag from `_count_gate_arities_openqasm`.
Copy link
Copy Markdown
Member

@natestemen natestemen left a comment

Choose a reason for hiding this comment

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

LGTM! Just some small questions/comments.

Comment thread mitiq/typing.py
Comment thread mitiq/interface/conversions.py
@natestemen natestemen linked an issue Dec 3, 2025 that may be closed by this pull request
@natestemen natestemen merged commit 9e7f692 into unitaryfoundation:main Dec 3, 2025
11 checks passed
@ACE07-Sev ACE07-Sev mentioned this pull request Dec 6, 2025
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.

Directly support openQASM circuits

3 participants