-
-
Notifications
You must be signed in to change notification settings - Fork 59
🚚 Move dialect and type definitions to separate TableGen files #1570
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 all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
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
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
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
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
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
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
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
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
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
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
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,43 @@ | ||
| // 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 | ||
|
|
||
| #ifndef MLIR_DIALECT_QC_IR_QCDIALECT_TD | ||
| #define MLIR_DIALECT_QC_IR_QCDIALECT_TD | ||
|
|
||
| include "mlir/IR/DialectBase.td" | ||
|
|
||
| def QCDialect : Dialect { | ||
| let name = "qc"; | ||
|
|
||
| let summary = "The QC (reference semantics) dialect for quantum computing."; | ||
|
|
||
| let description = [{ | ||
| The QC dialect uses **reference semantics** where quantum operations | ||
| modify qubits in place, similar to how hardware physically transforms | ||
| quantum states. This model provides: | ||
|
|
||
| - Natural mapping to hardware execution models | ||
| - Intuitive representation for circuit descriptions | ||
| - Direct compatibility with imperative quantum programming languages | ||
| - Straightforward backend code generation | ||
|
|
||
| The name "QC" stands for "Quantum Circuit." | ||
|
|
||
| Example: | ||
| ```mlir | ||
| qc.h %q // Applies Hadamard to qubit %q in place | ||
| qc.swap %q0, %q1 // Applies SWAP using %q0, %q1 as targets | ||
| ``` | ||
| }]; | ||
|
|
||
| let cppNamespace = "::mlir::qc"; | ||
|
|
||
| let useDefaultTypePrinterParser = 1; | ||
| } | ||
|
|
||
| #endif // MLIR_DIALECT_QC_IR_QCDIALECT_TD |
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
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
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,31 @@ | ||
| // 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 | ||
|
|
||
| #ifndef MLIR_DIALECT_QC_IR_QCTYPES_TD | ||
| #define MLIR_DIALECT_QC_IR_QCTYPES_TD | ||
|
|
||
| include "mlir/Dialect/QC/IR/QCDialect.td" | ||
|
|
||
| include "mlir/IR/AttrTypeBase.td" | ||
|
|
||
| class QCType<string name, string typeMnemonic, list<Trait> traits = []> | ||
| : TypeDef<QCDialect, name, traits> { | ||
| let mnemonic = typeMnemonic; | ||
| } | ||
|
|
||
| def QubitType : QCType<"Qubit", "qubit"> { | ||
| let summary = "QC qubit reference type"; | ||
| let description = [{ | ||
| The `!qc.qubit` type represents a reference to a quantum bit in the | ||
| QC dialect. Operations using this type modify qubits in place using | ||
| reference semantics, similar to how classical imperative languages handle | ||
| mutable references. | ||
| }]; | ||
| } | ||
|
|
||
| #endif // MLIR_DIALECT_QC_IR_QCTYPES_TD |
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
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,43 @@ | ||
| // 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 | ||
|
|
||
| #ifndef MLIR_DIALECT_QCO_IR_QCODIALECT_TD | ||
| #define MLIR_DIALECT_QCO_IR_QCODIALECT_TD | ||
|
|
||
| include "mlir/IR/DialectBase.td" | ||
|
|
||
| def QCODialect : Dialect { | ||
| let name = "qco"; | ||
|
|
||
| let summary = "The QCO (value semantics) dialect for quantum computing."; | ||
|
|
||
| let description = [{ | ||
| The QCO dialect uses **value semantics** where quantum operations | ||
| consume input qubits and produce new output values, following the | ||
| functional programming and SSA paradigm. This model enables: | ||
|
|
||
| - Powerful compiler optimizations through clear dataflow | ||
| - Safe reordering and parallelization analysis | ||
| - Advanced transformation passes | ||
| - Explicit dependency tracking | ||
|
|
||
| The name "QCO" stands for "Quantum Circuit Optimization." | ||
|
|
||
| Example: | ||
| ```mlir | ||
| %q_out = qco.h %q_in // Consumes %q_in, produces %q_out | ||
| %q0_out, %q1_out = qco.swap %q0_in, %q1_in // Consumes inputs, produces outputs | ||
| ``` | ||
| }]; | ||
|
|
||
| let cppNamespace = "::mlir::qco"; | ||
|
|
||
| let useDefaultTypePrinterParser = 1; | ||
| } | ||
|
|
||
| #endif // MLIR_DIALECT_QCO_IR_QCODIALECT_TD |
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.