-
-
Notifications
You must be signed in to change notification settings - Fork 59
✨ Integrate registers #1580
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
✨ Integrate registers #1580
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
3df8777
Replace behavior of allocQubitRegister() methods
denialhaag d318cba
Update conversion from QC to QIR
denialhaag 98f4055
Update conversion between QCO and Jeff
denialhaag 6458e73
Fix QC IR tests
denialhaag 685551b
Fix QCO IR tests
denialhaag 3e8d254
Fix QC-to-QIR tests
denialhaag 5253e14
Fix linter errors
denialhaag 4b02d3f
Fix some more tests
denialhaag 47f84a8
Exclude Jeff tests from discovery for now
denialhaag 5eb6778
Support static qubits in QIR again
denialhaag 8f80b98
Load results once
denialhaag 9887b3f
Fix sorting of qtensor.insert statements
denialhaag 12d9443
Fix linter errors
denialhaag 4622c95
Resolve some TODOs
denialhaag 56f5771
Improve documentation
denialhaag f8619ed
Address the Rabbit's comments
denialhaag f52206b
Fix linter errors
denialhaag 068de19
Address the Rabbit's comments
denialhaag d1fd730
Fix linter error
denialhaag a86274e
Address the Rabbit's comments
denialhaag b1eb566
Merge remote-tracking branch 'origin/main' into registers
denialhaag 58abb28
Address the Rabbit's comments
denialhaag ad7f265
Initialize at top of entry block
denialhaag 3e7bbf0
Address the Rabbit's comments
denialhaag ffd6426
Fix linter errors
denialhaag af9fa1f
Merge remote-tracking branch 'origin/main' into registers
denialhaag f0b1b4d
Make everything work again
denialhaag 9f2dc2a
Save one materialization
denialhaag 6e047dd
Make tensor map region-based as well
denialhaag 7038926
Address the Rabbit's comments
denialhaag 5660b64
Fix linter errors
denialhaag f81c35a
Address the Rabbit's comments
denialhaag 112c478
Merge branch 'main' into registers
burgholzer 2623d9b
📝 Add changelog entry
burgholzer 3574819
🎨 Small tweaks to the QC program builder
burgholzer 1fc2430
♻️ Add back fold for `qtensor.insert` and enhance capabilities of the…
burgholzer a4aa18a
🚸 Generalize IRVerification to handle commuting chains of `qtensor.in…
burgholzer f10935e
🎨 Small tweaks to the QCO program builder
burgholzer 00b1c83
♻️ Add canonicalization for interleaved extract-insert operations
burgholzer dbbf154
♻️ Turn `qco.reset` canonicalization into fold and handle tensor oper…
burgholzer badf76f
♻️ Turn zero-angle rotation gate canonicalizations into folds
burgholzer f2ac639
♻️ Expand QTensor commutation canonicalizations to also handle slices
burgholzer a2ab458
♻️ Extract common code from QTensor handling
burgholzer 3d800b9
⏪ Revert changes to programs
burgholzer 4a666b8
✨ Add QC pass for shrinking registers to fit accessed indices
burgholzer 3a94b90
✨ Add QCO pass for shrinking qtensors to fit accessed indices
burgholzer 1aeaf7a
✨ Add QIR pass for simplifying qubit-array allocation/release pairs
burgholzer 45b74aa
🎨 Miscellaneous small fixes
burgholzer c709efb
♻️ Adjust compiler pipeline and tests to use new passes
burgholzer 28d6c31
⚡ Reduce redundant lookups in QCToQCO.cpp
burgholzer 87cebaa
♻️ Streamline the QC to QCO conversion
burgholzer 9afcb0f
Merge branch 'refs/heads/main' into registers
burgholzer f0849fe
🔥 Remove `qtensor.insert_slice` and `qtensor.extract_slice` operations
burgholzer 7be6f12
✅ Add dedicated test suite for the QTensor dialect
burgholzer b5cfbbc
♻️ Do not default to dynamic shape for QTensor conversion from QCO to QC
burgholzer dcea944
🎨 Newline cosmetic
burgholzer 7409023
Fix linter errors
denialhaag c808bf1
Address some of the Rabbit's comments
denialhaag b5cebd3
Address the Rabbit's comments
denialhaag 2e50202
Fix linter errors
denialhaag fdced7d
Raise error if qc.dealloc is called manually
denialhaag 82510ba
Make areEquivalentIndices() more strict
denialhaag 18c7747
Return result of cleanup pipelines
denialhaag 5f719f9
Address the Rabbit's comments
denialhaag b149a67
Make index checks even more strict
denialhaag 8f18b6d
Add test
denialhaag e982b15
Address the Rabbit's comments
denialhaag 88def0f
Fix linter errors
denialhaag 51f719f
Address the Rabbit's final comment
denialhaag bf520ed
Address the Rabbit's final comment
denialhaag 543a27b
Streamline QTensor tests
denialhaag c16ce6e
Remove redundant folds
denialhaag 90978a0
Remove redundant canonicalization pattern
denialhaag 928a590
Fix linter errors
denialhaag f587454
Put back InsertOp::fold()
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
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 |
|---|---|---|
|
|
@@ -8,4 +8,5 @@ | |
|
|
||
| add_subdirectory(QC) | ||
| add_subdirectory(QCO) | ||
| add_subdirectory(QIR) | ||
| add_subdirectory(QTensor) | ||
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 |
|---|---|---|
|
|
@@ -7,3 +7,4 @@ | |
| # Licensed under the MIT License | ||
|
|
||
| add_subdirectory(IR) | ||
| add_subdirectory(Transforms) | ||
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 - 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 | ||
|
|
||
| set(LLVM_TARGET_DEFINITIONS Passes.td) | ||
| mlir_tablegen(Passes.h.inc -gen-pass-decls -name QC) | ||
| add_public_tablegen_target(MLIRQCTransformsIncGen) | ||
|
|
||
| add_mlir_doc(Passes QCTransforms Passes/ -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,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 | ||
| */ | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "mlir/Dialect/QC/IR/QCDialect.h" | ||
|
|
||
| #include <mlir/Pass/Pass.h> | ||
| #include <mlir/Pass/PassRegistry.h> | ||
|
|
||
| namespace mlir::qc { | ||
|
|
||
| #define GEN_PASS_DECL | ||
| #include "mlir/Dialect/QC/Transforms/Passes.h.inc" // IWYU pragma: export | ||
|
|
||
| //===----------------------------------------------------------------------===// | ||
| // Registration | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| /// Generate the code for registering passes. | ||
| #define GEN_PASS_REGISTRATION | ||
| #include "mlir/Dialect/QC/Transforms/Passes.h.inc" // IWYU pragma: export | ||
|
|
||
| } // 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // 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_TRANSFORMS_PASSES_TD | ||
| #define MLIR_DIALECT_QC_TRANSFORMS_PASSES_TD | ||
|
|
||
| include "mlir/Pass/PassBase.td" | ||
|
|
||
| def ShrinkQubitRegistersPass | ||
| : Pass<"qc-shrink-qubit-registers", "mlir::ModuleOp"> { | ||
| let dependentDialects = ["mlir::qc::QCDialect", "mlir::arith::ArithDialect", | ||
| "mlir::memref::MemRefDialect"]; | ||
| let summary = | ||
| "Shrink static qc::QubitType memref registers to accessed indices."; | ||
| let description = [{ | ||
| Shrinks one-dimensional static memref registers with element type | ||
| `!qc.qubit` by removing never-read indices and remapping `memref.load` | ||
| users accordingly. | ||
| }]; | ||
| } | ||
|
|
||
| #endif // MLIR_DIALECT_QC_TRANSFORMS_PASSES_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.