-
-
Notifications
You must be signed in to change notification settings - Fork 73
🐛 Preserve mapped feed-forward control #2351
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
+626
−77
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
6e8708c
🐛 Preserve mapped feed-forward control
simon1hofmann 8e7ad29
🔀 Update mapped control fix from main
simon1hofmann 8936bc2
📝 Record mapped control validation and gaps
simon1hofmann 1942185
Merge branch 'main' into codex/preserve-mapped-classical-control
MatthiasReumann a4c5712
Apply trivial fix
MatthiasReumann b31f07a
🎨 pre-commit fixes
pre-commit-ci[bot] 05fe7f2
Fix base profile requirements
MatthiasReumann 74c6f74
Merge branch 'codex/preserve-mapped-classical-control' of https://git…
MatthiasReumann 0e687f3
Merge branch 'main' into codex/preserve-mapped-classical-control
MatthiasReumann b6a7332
Add defer helper lambda
MatthiasReumann 6b8632e
Accept overwrites
MatthiasReumann 96af9c8
Fix lint
MatthiasReumann f1a5090
🐛 Fix measurement-dependent routing
simon1hofmann 2850cf5
🔀 Update mapped-control fixes from main
simon1hofmann 1432818
Final touches on implementation
MatthiasReumann 5bae6bc
Merge branch 'main' into codex/preserve-mapped-classical-control
MatthiasReumann aa1b13c
🐛 Preserve mapped control boundaries
burgholzer 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Preserve classical control during target mapping | ||
|
|
||
| Status: complete. Routing, terminal-measurement, and performance regressions | ||
| pass. | ||
|
|
||
| ## Goal and scope | ||
|
|
||
| Prevent routing SWAPs from creating a cyclic dependency through later classical | ||
| control. An independent wire can advance through a conditional whose measurement | ||
| depends on an unresolved two-qubit gate. Using that conditional's output as a | ||
| SWAP input can make the unresolved gate depend on its own result. | ||
|
|
||
| The production change belongs in | ||
| `mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp`. The mapping regression | ||
| checks valid output, target connectivity, and preservation of conditional work. | ||
| Two sorter regressions cover repeated stores to one register element and a | ||
| whole-register write followed by an indexed load during dominance repair. | ||
|
|
||
| ## Decisions | ||
|
|
||
| - Keep main's recursive memory-effect ordering and FIFO topological sorter from | ||
| #2436 unchanged. The sorter preserves mutable-register dependencies but cannot | ||
| repair a cycle introduced by routing. | ||
| - Do not require measurement/store adjacency in the mapper. Native Qiskit export | ||
| supports intervening quantum operations since #2439. | ||
| - Defer composites while an earlier wire operation still needs routing. Terminal | ||
| sinks and output-only measurements must not block independent quantum work. | ||
| - Use one measurement classification for advancement and composite deferral. | ||
| Follow SSA result uses and forward whole-register effects until reaching | ||
| quantum work. Register accesses before the measurement run do not require | ||
| measured-qubit reuse. Output-only loads and overwrites remain terminal; | ||
| register accesses inside quantum composites still impose ordering. | ||
| - Keep consecutive measurements in scope so an earlier measurement does not hide | ||
| a later result used for quantum control. Reuse LLVM slice analysis and a | ||
| bounded worklist. Traverse it by index because discovering more effects can | ||
| append entries and invalidate iterators. No public API or dependency changes | ||
| are required. | ||
| - Cache consecutive-measurement suffix classifications within each `advance` | ||
| invocation, sharing slice and register work across the run. Discard the cache | ||
| before hot routing mutates the graph. | ||
| - Backward traversal of an idle nested block argument can reach its sentinel; | ||
| that exhausted wire does not defer another composite. | ||
| - Select the wire value crossing the composite's block-order boundary when | ||
| extending it. Another wire may already have advanced through a gate that | ||
| consumes a classical result of that composite; its current value would | ||
| introduce an SSA cycle. | ||
| - Prefer terminal measurements even when the target accepts adaptive programs. | ||
| Target permission does not replace program dependencies or placement | ||
| readiness. | ||
|
|
||
| ## Validation | ||
|
|
||
| Release unit tests pass: 100 mapping tests, 192 QCO utility tests, and 181 | ||
| compiler tests. The added cases cover idle nested wires, a conditional angle | ||
| consumed on another wire, terminal measurements after earlier register control, | ||
| and consecutive measurements with first/last result control and shared stores. | ||
|
|
||
| The consecutive-measurement probe at 4,000 measurements improved from 327.85 ms | ||
| to 2.398 ms before the boundary and earlier-access fixes. This measures mapping | ||
| alone on a synthetic workload, not a whole-program or corpus speedup. | ||
|
|
||
| Repository lint and full-file C++ lint against fixed base `ce608b082` pass. | ||
| These are local checks, not hosted CI or a full Benchpress corpus run. |
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.