-
-
Notifications
You must be signed in to change notification settings - Fork 45
🗺️ MLIR Dialect Redesign #1264
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
🗺️ MLIR Dialect Redesign #1264
Changes from all commits
Commits
Show all changes
426 commits
Select commit
Hold shift + click to select a range
3c719cc
Add docstrings to operations
denialhaag dc80d1c
Improve assembly format of flux.ctrl
denialhaag e71d02e
Add docstrings to conversion patterns
denialhaag e1da5a3
Add docstring to foldParameterArityTrait
denialhaag b63e248
Put translation on a more permanent footing
denialhaag b570fb8
Make all operations controllable in Quartz-to-Flux conversion
denialhaag 5281f15
Make all operations controllable in Flux builder
denialhaag c3e9d23
WIP: Convert CtrlOp to QIR
denialhaag 95c77cf
Fix linter errors
denialhaag 5c6acd4
Add verifiers to CtrlOps
denialhaag b58e9b2
Merge branch 'main' into dialect-implementation
burgholzer 7440f12
🚨 silence a compiler warning
burgholzer 37de9e7
♻️ refactor parameter handling
burgholzer bda0237
🚧 WIP better module equivalence checking
burgholzer ebd73f9
♻️ refactor QIR conversion and builder to comply with QIR 2.0
burgholzer 0684b54
🚧 WIP on ctrl modifier
burgholzer 49a830c
🚨 fix compiler warnings
burgholzer 04ce9f9
♻️ fix CtrlOp handling and improve conversions
burgholzer 6a536fe
Merge branch 'main' into dialect-implementation
burgholzer 0d1a582
♻️ make Quartz and Flux builder directly inherit from OpBuilder
burgholzer aba0103
Fix a good portion of the linter errors
denialhaag 02307e9
Fix more linter errors
denialhaag f168c05
Support CX conversion to QIR
denialhaag 2a7eb06
Streamline unitary tests
denialhaag be7f87b
Also support CRX, CU2, and CWAP conversions to QIR
denialhaag 0f700c3
Fix linter errors
denialhaag 077360f
Fix linter error about nondeterministic order
denialhaag a4b9075
Fix QIR of conversion of quartz.measure
denialhaag a30417b
Streamline QIR conversions
denialhaag 8d88a48
Revert "Fix linter error about nondeterministic order"
denialhaag c09b40f
Include correct header
denialhaag f15c9a2
Use QIR conversion state for converting controlled operations
denialhaag 5aebf4a
Fix static matrices and add initial support for controlled ones
denialhaag ce03531
Remove unnecessary header
denialhaag 8ab3435
Remove unnecessary headers
denialhaag 53ba841
Fix static matrices for multiple controls
denialhaag 3d4b879
Add support for S and Sdg without looking for commonalities yet
denialhaag e606f3f
Streamline conversions by defining template functions
denialhaag 4ebb7f2
Streamline builders by defining template functions
denialhaag 2428304
Add support for Id
denialhaag 6412088
Add support for Y, Z, H, T, Tdg, SX, and SXdg
denialhaag 8130308
Use std::numbers::pi
denialhaag b7ee9b9
Improve support for nested regions
denialhaag 2aca4ab
Streamline canonicalizations by defining template functions
denialhaag 8798f34
Fix linter errors
denialhaag f55ebba
Ignore this one linter error
denialhaag 80715e7
Fix remaining linter errors
denialhaag cfe1576
Include missing header
denialhaag d6ced4d
Modularize standard gates
denialhaag 7eb161a
Fix linter errors
denialhaag 92019ce
Add support for RY
denialhaag 4fe3739
Add support for RZ and P
denialhaag 85a3956
Fix linter errors
denialhaag b71e6fc
Rename removeInversePair()
denialhaag a487837
Streamline canonicalizations by defining template functions
denialhaag dff917d
Modularize modifiers
denialhaag 530e847
Support multi-controlled operations in QIR
denialhaag dd599ca
Simplify template functions of QIR builders
denialhaag 639afe8
Add support for R
denialhaag 466eb0a
Add support for iSWAP
denialhaag 05db54f
Fix linter errors
denialhaag bbd10c3
Add canonicalizer to SWAP
denialhaag 866c2c3
Add untested canonicalizer to U2
denialhaag 65eeab9
Fix linter errors
denialhaag 7f8d5ab
Merge branch 'main' into dialect-implementation
denialhaag adc03b8
Merge branch 'main' into dialect-implementation
denialhaag f3f3ebe
Use macros to define Quartz builder methods
denialhaag fbbe245
Use macros also for Flux and QIR builders
denialhaag af9de49
Use macros for converters
denialhaag cff1d62
Use macros for builder header files
denialhaag aae623c
Add support for DCX and ECR
denialhaag 7442fc5
Add support for U
denialhaag 41298c6
Add support for RXX
denialhaag e45bf4b
Add support for XXPlusYY
denialhaag f02d52e
Add support for RYY, RZX, and RZZ
denialhaag f4778f8
Add support for XXMinusYY
denialhaag 0800cb7
Remove unnecessary header inclusions
denialhaag d6924e3
Merge branch 'main' into dialect-implementation
denialhaag f3085a1
Fix linter error
denialhaag dfa7a78
Get rid of Flux helpers because they are no longer helpful
denialhaag 46dece7
Simplify QIR helpers
denialhaag cf2f9dd
Merge branch 'main' into dialect-implementation
denialhaag 171adda
🎨 pre-commit fixes
pre-commit-ci[bot] 06b576c
Use macros for translation
denialhaag eb7b62e
Implement all merge and inverse-pair canonicalizations
denialhaag b73803d
Add canonicalizations for XXPlusYY and XXMinusYY
denialhaag 7e6ce39
Fix equivalence checking of constants
denialhaag b5bc9c4
Further modularize operations
denialhaag 614e2ca
Use macros for QIR function names
denialhaag bdade00
Run linter on all files
denialhaag 1280e4c
Add square-root canonicalizations
denialhaag db73361
Remove unnecessary headers
denialhaag b2876b9
Maybe fix linter error
denialhaag d5f3e57
Add canonicalization patterns for removing trivial rotations
denialhaag 2642929
Add initial support for GPhase
denialhaag 73d8471
Revert "Maybe fix linter error"
denialhaag 4c8e042
Fix docstrings for GPhase
denialhaag b14efec
Fix header path
denialhaag 3a7df64
Use MemWrite instead of MemAlloc
denialhaag d8fd8a0
Fix linter errors
denialhaag 5b0aeec
Another attempt at fixing the linter error about slicing
denialhaag f80bc01
Revert "Another attempt at fixing the linter error about slicing"
denialhaag d94463c
Fix conversion of controlled GPhase operations
denialhaag 280ec05
Streamline qubit variables
denialhaag 9d557b1
Add support for barriers
denialhaag 957b5d8
Remove matrix extraction for now
denialhaag 1eb3607
Fix linter errors
denialhaag 754372e
Add barrier canonicalization and remove it from QIR
denialhaag 984212d
Add Bell test
denialhaag d01d260
Add current version of cgphase test
denialhaag 319c19d
Add test for already implemented U2 canonicalization
denialhaag e360420
Add remaining U2 canonicalizations
denialhaag 280d3a6
Add R canonicalizations
denialhaag 3c0baaa
Add U canonicalizations
denialhaag a640013
Look forward instead of backward for barrier canonicalization
denialhaag 93b53c5
Inline controlled GPhaseOps in Flux
denialhaag 248b411
Drop support for controlled global phases in QIR
denialhaag f718704
Inline controlled GPhaseOps in Quartz
denialhaag 29e5db2
Fix linter errors
denialhaag 50933e2
Ignore slicing error for now
denialhaag 87bdd11
Remove everything related to memref
denialhaag c892f42
Fix docstrings and descriptions
denialhaag 0d8c771
Trivial code simplifications
denialhaag d9507b6
Add assertion messages
denialhaag d9ed92f
Add bounds checks on qubit index
denialhaag d4a1c8f
Make QIR builder private again
denialhaag a89530e
Rename TRANSLATION_HEADERS_SOURCE
denialhaag 8fafdc2
Remove redundant glob patterns
denialhaag 6aed309
Add RemoveTrivialP pattern
denialhaag aa6627f
Remove unnecessary header
denialhaag b6b62c1
Simplify Value initializations
denialhaag b7b22a8
Improve comparison of floating-point values
denialhaag dded22b
Remove state from addInitialize()
denialhaag 09b0086
Fix module initialization
denialhaag f091b44
Add guard to FluxUtils.h
denialhaag c9d4bd5
Improve comparison of betas
denialhaag 1458542
Do not using namespace in FulxUtils.h
denialhaag 61dcd02
Replace asserts with fatal errors
denialhaag 7a8f91f
Use reportFatalUsageError where it makes sense
denialhaag c4a3e6a
Remove unnecessary flushes
denialhaag a6e0dec
Use getNumPosControls()
denialhaag e8533d2
Simplify builders by defining a helper function
denialhaag 96411ee
Rename PhaseOp.cpp
denialhaag 813f2d7
Rename odsBuilder and odsState arguments
denialhaag 97950e0
Include variant
denialhaag 2669b30
Make use of interface methods in canonicalization patterns
denialhaag 7b75a94
Remove unnecessary header
denialhaag 0537ffb
Fix module initialization
denialhaag f5529be
Fix linter errors
denialhaag 5a2842c
Fix remaining linter errors
denialhaag 9c8242f
Improve error handling
denialhaag c637630
Improve null safety in QIRUtils.cpp
denialhaag 7bdb289
Fix insertion point
denialhaag de23c39
Add bounds checks to CtrlOp methods
denialhaag a0e54d5
Fix docstrings
denialhaag e7ac020
Validate register size
denialhaag cccac6f
Validate static index
denialhaag 25b8805
Use inline constexpr instead of static constexpr
denialhaag c2513ec
Include headers in header file
denialhaag b53ccd6
Streamline Flux helpers
denialhaag b1d352a
Clarify insertion guard names
denialhaag dcb2b08
Mark command-line options as static instead of const
denialhaag 4f2b535
Add comment to explain handling of nested CtrlOps
denialhaag cca9959
Make use of getParameter() to improve readability of conversions
denialhaag 998242c
Improve documentation of compiler pipeline
denialhaag 481bc80
Revert "Mark command-line options as static instead of const"
denialhaag 218cb98
Further improve null safety in QIRUtils.cpp
denialhaag bebe71b
Do not explicitly erase body CtrlOp
denialhaag 448feea
Fix RemoveTrivialCtrl patterns
denialhaag bd42b36
Use op.emitError() instead of llvm::errs()
denialhaag 282dca8
Do not using OpConversionPattern
denialhaag c28b779
Validate result index
denialhaag af4ed3c
Fix docstring
denialhaag 1713672
Add unit test for nested CtrlOps
denialhaag fc1c4a4
Include more headers in header files
denialhaag 5bfe41a
Simply erase operation in RemoveTrivialCtrl pattern for Quartz
denialhaag d342a27
Remove const from Value and ValueRange
denialhaag d792424
Remove const from more Values
denialhaag 6eabd43
Use factor method to create ModuleOp
denialhaag 71ba049
Add --record-intermediates flag
denialhaag 0776019
Update docstrings in QIRUtils.h
denialhaag 3999b42
Document current limitations of Quartz-to-QIR conversion
denialhaag a382021
Remove dialect-name variables
denialhaag 4c655b3
Let pipeline fail if config is not valid
denialhaag bbbe2b7
Load dialects in constructors
denialhaag 864dbf2
Make default classical-register name more safe
denialhaag 94458a8
Make createResultLabel more safe
denialhaag c50594b
Ensure that builders cannot be used after finalization
denialhaag 8cc1959
Use auto instead of Value to maybe get rid of const linter errors
denialhaag d574f84
Ignore downcast linter error for now
denialhaag e15acd9
Bump minimum MLIR version for clarity
denialhaag b3545bf
Sort qubits before deallocating
denialhaag 842c653
Add assertions to Quartz-to-Flux conversion
denialhaag 6b447a2
Give ClassicalRegister ownership of name
denialhaag 14cab18
Fix trivial CtrlOps
denialhaag 657d1c7
Do not use const std::string
denialhaag ba33fa1
Save name before inserting it into DenseMap
denialhaag 351bb36
Fix docstrings
denialhaag 4374c90
Update docs to reflect corrected required LLVM version
denialhaag 02a7611
Add error handling to translation
denialhaag adf603b
Validate builder states before finalizing
denialhaag 48f5097
Improve state validation in runPipeline()
denialhaag b4b39a5
Include missing headers in header files
denialhaag 30f2fb6
Remove unused variables
denialhaag 1424035
Ensure that builders cannot be finalized twice
denialhaag ef12141
Improve deallocation order
denialhaag fd6e2f1
Include missing header
denialhaag c8fcc5a
Improve docstrings
denialhaag 157a469
Improve more docstrings
denialhaag a764536
Fix assembly formats of some Quartz operations
denialhaag 04c8b04
Improve docstrings one more time
denialhaag 1194973
Improve error message if bit index is out of bounds
denialhaag ef698db
Fix linter errors
denialhaag e5cd6d1
Use llvm::cast to fix linter error
denialhaag f02db72
Remove redesign concept
denialhaag b171269
Revert "Use llvm::cast to fix linter error"
denialhaag 32a7092
✏️ docstring fixes
burgholzer d8a182a
🚨 include fixes reported by local clang-tidy
burgholzer c02310c
👌 address code rabbit comment
burgholzer 4bece21
🔧 lower tolerance
burgholzer 5082913
🐛 Fix canonicalization of controlled global phase
burgholzer c333456
✏️ ensure consistent parameter names
burgholzer 3ffb553
🚨 add a dedicated clang-tidy file for MLIR
burgholzer 58cd84c
🚨 some more clang-tidy fixes
burgholzer 7eedc26
🚨 hide noisy clang-tidy warning for LLVM
burgholzer 9b41f85
👌 code rabbit fixes
burgholzer 0fd3566
🎨 miscellaneous code quality improvements
burgholzer a1f39d9
Rename Quartz to QC and Flux to QCO
denialhaag 7e73480
Do not check llvm-include-order
denialhaag 476d743
Fix linter errors
denialhaag e1d3de8
Update changelog
denialhaag 8d8faeb
Merge branch 'main' into dialect-implementation
denialhaag b44ba89
Address the Rabbit's comments
denialhaag e195428
Fix remaining linter errors
denialhaag 9cb28d0
Address the Rabit's remaining comments
denialhaag 421cf4b
Update dialect descriptions
denialhaag c76577c
One more fix for the Rabbit
denialhaag b2837ad
Do not mark type as const
denialhaag e3b24f3
Do not annotate F64 values
denialhaag e017879
Fix intermediate recording
denialhaag f315640
Improve description of CtrlOp
denialhaag c2998d3
Mark operator<< as maybe unused
denialhaag 3db1dfe
Fix naming of QIR blocks
denialhaag 5acaff9
Do not mark filename as const
denialhaag eb903d0
Streamline assembly formats
denialhaag aa56d96
Improve description of YieldOp
denialhaag 6a116a7
Improve compilation-record messages
denialhaag 1f9378e
Throw out negative controls altogether
denialhaag d536db3
Use correct register map
denialhaag 4de31e1
Undo accidental change
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
Some comments aren't visible on the classic Files Changed page.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| InheritParentConfig: true | ||
| Checks: | | ||
| llvm-namespace-comment, | ||
| llvm-prefer-isa-or-dyn-cast-in-conditionals, | ||
| llvm-prefer-register-over-unsigned, | ||
| llvm-prefer-static-over-anonymous-namespace, | ||
| -misc-use-anonymous-namespace, | ||
| llvm-twine-local, | ||
| -cppcoreguidelines-pro-bounds-avoid-unchecked-container-access |
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,145 @@ | ||
| /* | ||
| * Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| * Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| * All rights reserved. | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * Licensed under the MIT License | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <mlir/Pass/PassManager.h> | ||
| #include <mlir/Support/LogicalResult.h> | ||
| #include <string> | ||
|
|
||
| namespace mlir { | ||
| class ModuleOp; | ||
|
|
||
| /** | ||
| * @brief Configuration for the quantum compiler pipeline | ||
| * | ||
| * @details | ||
| * Controls which stages of the compilation pipeline are executed and | ||
| * diagnostic options for profiling and debugging. | ||
| */ | ||
| struct QuantumCompilerConfig { | ||
| /// Convert to QIR at the end of the pipeline | ||
| bool convertToQIR = false; | ||
|
|
||
| /// Record intermediate IR at each stage for debugging/testing | ||
| bool recordIntermediates = false; | ||
|
|
||
| /// Enable pass timing statistics (MLIR builtin) | ||
| bool enableTiming = false; | ||
|
|
||
| /// Enable pass statistics (MLIR builtin) | ||
| bool enableStatistics = false; | ||
|
|
||
| /// Print IR after each stage | ||
| bool printIRAfterAllStages = false; | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Records the state of IR at various compilation stages | ||
| * | ||
| * @details | ||
| * Stores string representations of the MLIR module at different | ||
| * points in the compilation pipeline. Useful for testing and debugging. | ||
| * All stages are recorded when recordIntermediates is enabled. | ||
| */ | ||
| struct CompilationRecord { | ||
| std::string afterQCImport; | ||
| std::string afterInitialCanon; | ||
| std::string afterQCOConversion; | ||
| std::string afterQCOCanon; | ||
| std::string afterOptimization; | ||
| std::string afterOptimizationCanon; | ||
| std::string afterQCConversion; | ||
| std::string afterQCCanon; | ||
| std::string afterQIRConversion; | ||
| std::string afterQIRCanon; | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Main quantum compiler pipeline | ||
| * | ||
| * @details | ||
| * Provides a high-level interface for compiling quantum programs through | ||
| * the MQT compiler infrastructure. The pipeline stages are: | ||
| * | ||
| * 1. QC dialect (reference semantics) - imported from | ||
| * qc::QuantumComputation | ||
| * 2. Canonicalization + cleanup | ||
| * 3. QCO dialect (value semantics) - enables SSA-based optimizations | ||
| * 4. Canonicalization + cleanup | ||
| * 5. Quantum optimization passes | ||
| * 6. Canonicalization + cleanup | ||
| * 7. QC dialect - converted back for backend lowering | ||
| * 8. Canonicalization + cleanup | ||
| * 9. QIR (Quantum Intermediate Representation) - optional final lowering | ||
| * 10. Canonicalization + cleanup | ||
| * | ||
| * Following MLIR best practices, canonicalization and dead value removal | ||
| * are always run after each major transformation stage. | ||
| */ | ||
| class QuantumCompilerPipeline { | ||
| public: | ||
| explicit QuantumCompilerPipeline(const QuantumCompilerConfig& config = {}) | ||
| : config_(config) {} | ||
|
|
||
| /** | ||
| * @brief Run the complete compilation pipeline on a module | ||
| * | ||
| * @details | ||
| * Executes all enabled compilation stages on the provided MLIR module. | ||
| * If recordIntermediates is enabled in the config, captures IR snapshots | ||
| * at every stage (10 snapshots total for full pipeline). | ||
| * | ||
| * Automatically configures the PassManager with: | ||
| * - Timing statistics if enableTiming is true | ||
| * - Pass statistics if enableStatistics is true | ||
| * - IR printing after each stage if printIRAfterAllStages is true | ||
| * | ||
| * @param module The MLIR module to compile | ||
| * @param record Optional pointer to record intermediate states | ||
| * @return success() if compilation succeeded, failure() otherwise | ||
| */ | ||
| LogicalResult runPipeline(ModuleOp module, | ||
| CompilationRecord* record = nullptr) const; | ||
|
|
||
| private: | ||
| /** | ||
| * @brief Add canonicalization and cleanup passes | ||
| * | ||
| * @details | ||
| * Always adds the standard MLIR canonicalization pass followed by dead | ||
| * value removal. | ||
| */ | ||
| static void addCleanupPasses(PassManager& pm); | ||
|
|
||
| /** | ||
| * @brief Configure PassManager with diagnostic options | ||
| * | ||
| * @details | ||
| * Enables timing, statistics, and IR printing based on config flags. | ||
| * Uses MLIR's builtin PassManager configuration methods. | ||
| */ | ||
| void configurePassManager(PassManager& pm) const; | ||
|
|
||
| QuantumCompilerConfig config_; | ||
| }; | ||
|
|
||
| /** | ||
| * @brief Utility to capture IR as string | ||
| * | ||
| * @details | ||
| * Prints the MLIR module to a string for recording or comparison. | ||
| * | ||
| * @param module The module to convert to string | ||
| * @return String representation of the IR | ||
| */ | ||
| std::string captureIR(ModuleOp module); | ||
|
|
||
| } // namespace mlir |
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,13 @@ | ||
| # Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| # Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # Licensed under the MIT License | ||
|
|
||
| set(LLVM_TARGET_DEFINITIONS QCOToQC.td) | ||
| mlir_tablegen(QCOToQC.h.inc -gen-pass-decls -name QCOToQC) | ||
| add_public_tablegen_target(QCOToQCIncGen) | ||
|
|
||
| add_mlir_doc(QCOToQC MLIRQCOToQC Conversions/ -gen-pass-doc) |
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,21 @@ | ||
| /* | ||
| * Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| * Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| * All rights reserved. | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * Licensed under the MIT License | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <mlir/Pass/Pass.h> // from @llvm-project | ||
|
|
||
| namespace mlir { | ||
| #define GEN_PASS_DECL_QCOTOQC | ||
| #include "mlir/Conversion/QCOToQC/QCOToQC.h.inc" | ||
|
|
||
| #define GEN_PASS_REGISTRATION | ||
| #include "mlir/Conversion/QCOToQC/QCOToQC.h.inc" | ||
| } // namespace mlir |
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,26 @@ | ||
| // Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| // Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| // All rights reserved. | ||
| // | ||
| // SPDX-License-Identifier: MIT | ||
| // | ||
| // Licensed under the MIT License | ||
|
|
||
| include "mlir/Pass/PassBase.td" | ||
|
|
||
| def QCOToQC : Pass<"qco-to-qc"> { | ||
| let summary = "Convert QCO dialect to QC dialect."; | ||
|
|
||
| let description = [{ | ||
| This pass converts all operations from the QCO dialect to their equivalent | ||
| operations in the QC dialect. It handles the transformation of qubit | ||
| values in QCO to qubit references in QC, ensuring that the semantics | ||
| of quantum operations are preserved during the conversion process. | ||
| }]; | ||
|
|
||
| // Define dependent dialects | ||
| let dependentDialects = [ | ||
| "mlir::qco::QCODialect", | ||
| "mlir::qc::QCDialect" | ||
| ]; | ||
| } |
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,13 @@ | ||
| # Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| # Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # Licensed under the MIT License | ||
|
|
||
| set(LLVM_TARGET_DEFINITIONS QCToQCO.td) | ||
| mlir_tablegen(QCToQCO.h.inc -gen-pass-decls -name QCToQCO) | ||
| add_public_tablegen_target(QCToQCOIncGen) | ||
|
|
||
| add_mlir_doc(QCToQCO MLIRQCToQCO Conversions/ -gen-pass-doc) |
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,21 @@ | ||
| /* | ||
| * Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| * Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| * All rights reserved. | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * Licensed under the MIT License | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <mlir/Pass/Pass.h> // from @llvm-project | ||
|
|
||
| namespace mlir { | ||
| #define GEN_PASS_DECL_QCTOQCO | ||
| #include "mlir/Conversion/QCToQCO/QCToQCO.h.inc" | ||
|
|
||
| #define GEN_PASS_REGISTRATION | ||
| #include "mlir/Conversion/QCToQCO/QCToQCO.h.inc" | ||
| } // namespace mlir |
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,26 @@ | ||
| // Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| // Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| // All rights reserved. | ||
| // | ||
| // SPDX-License-Identifier: MIT | ||
| // | ||
| // Licensed under the MIT License | ||
|
|
||
| include "mlir/Pass/PassBase.td" | ||
|
|
||
| def QCToQCO : Pass<"qc-to-qco"> { | ||
| let summary = "Convert QC dialect to QCO dialect."; | ||
|
|
||
| let description = [{ | ||
| This pass converts all operations from the QC dialect to their equivalent | ||
| operations in the QCO dialect. It handles the transformation of qubit | ||
| references in QC to qubit values in QCO, ensuring that the semantics | ||
| of quantum operations are preserved during the conversion process. | ||
| }]; | ||
|
|
||
| // Define dependent dialects | ||
| let dependentDialects = [ | ||
| "mlir::qc::QCDialect", | ||
| "mlir::qco::QCODialect" | ||
| ]; | ||
| } |
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,13 @@ | ||
| # Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| # Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # Licensed under the MIT License | ||
|
|
||
| set(LLVM_TARGET_DEFINITIONS QCToQIR.td) | ||
| mlir_tablegen(QCToQIR.h.inc -gen-pass-decls -name QCToQIR) | ||
| add_public_tablegen_target(QCToQIRIncGen) | ||
|
|
||
| add_mlir_doc(QCToQIR MLIRQCToQIR Conversions/ -gen-pass-doc) |
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,21 @@ | ||
| /* | ||
| * Copyright (c) 2023 - 2025 Chair for Design Automation, TUM | ||
| * Copyright (c) 2025 Munich Quantum Software Company GmbH | ||
| * All rights reserved. | ||
| * | ||
| * SPDX-License-Identifier: MIT | ||
| * | ||
| * Licensed under the MIT License | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <mlir/Pass/Pass.h> // from @llvm-project | ||
|
|
||
| namespace mlir { | ||
| #define GEN_PASS_DECL_QCTOQIR | ||
| #include "mlir/Conversion/QCToQIR/QCToQIR.h.inc" | ||
|
|
||
| #define GEN_PASS_REGISTRATION | ||
| #include "mlir/Conversion/QCToQIR/QCToQIR.h.inc" | ||
| } // namespace mlir |
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.