-
-
Notifications
You must be signed in to change notification settings - Fork 63
✨ Add OpenQASM-to-QC translation #1780
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
Merged
Merged
Changes from 40 commits
Commits
Show all changes
54 commits
Select commit
Hold shift + click to select a range
35c240a
✨ Add translation for QASM3 -> QC
J4MMlE dac020c
Fix build error
denialhaag 8036f1f
Adapt to new include style
denialhaag ad156d3
Begin to fix linter errors
denialhaag a22ab4f
Remove explicit namespace specifier
denialhaag 71c4bcd
Drop support for legacy loader
denialhaag e99fcca
Add first test
denialhaag f6d248c
Fix some more linter errors
denialhaag 5aa5f74
Add more test cases
denialhaag 987f667
Fix some more linter errors
denialhaag 16a3da7
Replace .qasm files with in-source strings
denialhaag 24dccde
Fix some more linter errors
denialhaag 9c4aaa0
Slightly improve doctrings
denialhaag 10ddff2
Drop support for register comparisons for now
denialhaag 27f59a6
Fix remaining linter errors
denialhaag 286accf
Address the Rabbit's comments
denialhaag 1953fff
Drop support for compound gates for now
denialhaag 6e356ae
Adapt implementation to more-control
denialhaag 3260e76
Remove TODO comments
denialhaag 5f6e5c9
Revert "Drop support for compound gates for now"
denialhaag 8e73857
Adapt conversion of compound gates
denialhaag fc7fa5b
Streamline docstrings
denialhaag 36dd8d3
Fix linter errors
denialhaag b9a1be8
Fix linter error
denialhaag c216c15
Merge remote-tracking branch 'origin/main' into open-qasm
denialhaag d9ada9c
Address the Rabbit's comments from #1671
denialhaag 0ef19d9
Improve coverage a bit
denialhaag e0d2781
Clean up and simplify
denialhaag a630133
Test broadcasting
denialhaag 301f23f
Test translation of OpenQASM 2 program
denialhaag 29b7e0d
Fix linter errors
denialhaag 39142e9
Merge remote-tracking branch 'origin/main' into open-qasm
denialhaag ac413ba
Address the Rabbit's comments
denialhaag e7ed9bd
Simplify IfStement helpers and improve coverage
denialhaag ebafce2
Merge remote-tracking branch 'origin/main' into open-qasm
denialhaag 6a11e8f
Improve documentation
denialhaag 198b77f
Address the Rabbit's out-of-diff comments
denialhaag 40e31f7
Fix broadcasting
denialhaag 89da071
Merge branch 'main' into open-qasm
denialhaag 238e2b7
Merge branch 'main' into open-qasm
burgholzer e8133ce
Skip InitialLayout and OutputPermutation pragmas
denialhaag a7a81b9
Use llvm::SourceMgr
denialhaag cce8134
Support if operations with empty then branches
denialhaag 77043ba
Fix linter errors
denialhaag 86bbf4b
Stop linking against MQT::CoreIR
denialhaag c06be11
Address the Rabbit's comment
denialhaag 8e6dd84
Remove 3
denialhaag 05727e5
Simplify link libraries
denialhaag 5882949
Update changelog
denialhaag c2ebdc6
Merge branch 'main' into open-qasm
denialhaag 19f5d95
Add overload that accepts a StringRef
denialhaag 683f558
Add mqt-cc-translate tool
denialhaag d0590fd
Fix linter errors
denialhaag 719764a
Remove mqt-cc-translate tool again
denialhaag File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
mlir/include/mlir/Dialect/QC/Translation/TranslateQASM3ToQC.h
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| /* | ||
| * Copyright (c) 2023 - 2026 Chair for Design Automation, TUM | ||
| * Copyright (c) 2025 - 2026 Munich Quantum Software Company GmbH | ||
| * All rights reserved. | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * Licensed under the MIT License | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <mlir/IR/BuiltinOps.h> | ||
| #include <mlir/IR/MLIRContext.h> | ||
|
|
||
| #include <iosfwd> | ||
| #include <string> | ||
|
|
||
| namespace mlir::qc { | ||
|
|
||
| /** | ||
| * @brief Translate an OpenQASM3 program to the QC dialect. | ||
| * | ||
| * @param context MLIRContext to create the module in. | ||
| * @param filename Path to the input OpenQASM3 file. | ||
| */ | ||
| [[nodiscard]] OwningOpRef<ModuleOp> | ||
| translateQASM3ToQC(MLIRContext* context, const std::string& filename); | ||
|
|
||
| /** | ||
| * @brief Translate an OpenQASM3 program to the QC dialect. | ||
| * | ||
| * @param context MLIRContext to create the module in. | ||
| * @param input Stream containing the OpenQASM3 program. | ||
| */ | ||
| [[nodiscard]] OwningOpRef<ModuleOp> translateQASM3ToQC(MLIRContext* context, | ||
| std::istream& input); | ||
|
|
||
| } // namespace mlir::qc | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.