✨ Add OpenQASM-to-QC translation#1780
Conversation
This reverts commit 00835a8.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
I will think about this a bit and respond tomorrow! |
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@mlir/include/mlir/Dialect/QC/Translation/TranslateQASM3ToQC.h`:
- Around line 13-26: The function translateQASM3ToQC uses OwningOpRef<ModuleOp>
as its return type but the header does not directly include the definition of
OwningOpRef, relying instead on transitive includes from BuiltinOps.h. Add
`#include` <mlir/IR/OwningOpRef.h> to the include section at the top of the file
along with the other mlir includes to make this header self-contained and
explicit about its dependencies.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 4b5a8e6b-daab-46b3-96dc-c6efd737f14b
📒 Files selected for processing (7)
mlir/include/mlir/Dialect/QC/Translation/TranslateQASM3ToQC.hmlir/lib/Dialect/QC/Translation/TranslateQASM3ToQC.cppmlir/tools/mqt-cc/CMakeLists.txtmlir/tools/mqt-cc/mqt-cc.cppmlir/unittests/Dialect/QC/Translation/test_qasm3_translation.cppmlir/unittests/programs/qasm_programs.cppmlir/unittests/programs/qasm_programs.h
💤 Files with no reviewable changes (1)
- mlir/tools/mqt-cc/CMakeLists.txt
burgholzer
left a comment
There was a problem hiding this comment.
This is very close to being mergable 🙂
Signed-off-by: Daniel Haag <121057143+denialhaag@users.noreply.github.com>
|
Thanks a lot for getting this started, @J4MMlE! Your initial version was a great foundation! 🙂 |
The current implementation is certainly limiting. It's probably not wise to keep updating MQT Core's
I also like the sound of the idea, but I'm not sure if we are unnecessarily creating additional work for ourselves. If such an OpenQASM 3 dialect has a chance of becoming established, I see the point in going for it. However, if it were to be an internal "tool" only, I feel like we'd be creating another hoop to jump through. For example, in my opinion, the current translation from OpenQASM 3 to QC benefits from the In short, if we plan to establish the OpenQASM 3 dialect as a standard used by others (much like Let me know what you think! One way or another, we need to ensure that we can translate arbitrary OpenQASM 3 programs into |
Yeah, I figured as much. The current parser implementation still ties quite heavily to the
I would not like to create an That being said, I would generally view an OpenQASM3 dialect as something fairly similar to On the point whether we'd actually still need the QC dialect: I think we'd still need it. OQ3 does not define individual gates (X, Y, Z, S, etc.); it also mixes classical and quantum constructs. Translating that to clearly separated dialects (QC + Standard Dialects) seems valuable to me. How does all of that sound? |
That all sounds good to me! I would be happy to get started on this rather soon, maybe after #1707 and potentially #1726. I don't have a super strong opinion on where the dialect should live. A repsoitory that contains the dialect, bi-directional translations, and bi-directional conversions (of everything but the gates) sounds neat, but it could also make sense within MQT Core. 🤔 |
Sounds like a plan to me! Since there is no obvious best choice for where the dialect should live, I'd argue let's keep it in MQT Core for now. We can always pull it out afterwards if that should proof beneficial. |
Description
This is a rebased version of #1671 after #1671 was automatically closed when #1751 was merged.
Original description by @J4MMlE:
Checklist
I have updated the documentation to reflect these changes.I have added migration instructions to the upgrade guide (if needed).