✨ Add direct OpenQASM to QC translation#1671
Draft
J4MMlE wants to merge 7 commits intomunich-quantum-toolkit:mainfrom
Draft
✨ Add direct OpenQASM to QC translation#1671J4MMlE wants to merge 7 commits intomunich-quantum-toolkit:mainfrom
J4MMlE wants to merge 7 commits intomunich-quantum-toolkit:mainfrom
Conversation
Signed-off-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
denialhaag
reviewed
Apr 29, 2026
Comment on lines
+76
to
+79
| static cl::opt<bool> directImport( | ||
| "direct-import", | ||
| cl::desc("Use direct QASM3 → QC import (bypasses QuantumComputation)"), | ||
| cl::init(false)); |
Member
There was a problem hiding this comment.
Is there currently any significant feature that requires the legacy loader? If not, I'd say we can drop this flag and remove the legacy function already in this PR. 🤔
Member
There was a problem hiding this comment.
Yeah. There is no need for any kind of deprecation period here. Let's just use the new functionality 👍🏻
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a direct QASM3 → QC dialect translation, bypassing
QuantumComputation.Previous flow:
OpenQASM -> AST ->
QuantumComputation-> QC dialectNew flow:
OpenQASM -> AST -> QC dialect
The new flow reuses the existing parser and walks the AST directly to emit QC dialect ops. Skipping
QuantumComputationremoves an intermediate step and enables QASM3 features previously unsupported, such as gate modifiers, classical computations and control flow structures.For now i added a
--direct-importflag to invoke the new direct translation - this will eventually be dropped, so that this direct translation becomes the new default.What works
ctrl @,negctrl @,inv @, nested combinationsif/elseover quantum statementsqc.staticCurrent limitations
powmodifier is unsupported (but will/should be, once it gets merged into main)QC)ifonly works up toqcbut should work for the whole pipeline once thescfconversion PR is inChecklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.