✨Map scf.for operations by restoration using the 4-approximation token swap algorithm#1805
Open
MatthiasReumann wants to merge 62 commits into
Open
✨Map scf.for operations by restoration using the 4-approximation token swap algorithm#1805MatthiasReumann wants to merge 62 commits into
scf.for operations by restoration using the 4-approximation token swap algorithm#1805MatthiasReumann wants to merge 62 commits into
Conversation
…quantum-toolkit/core into enh/sc-map-scf-for-loops
…quantum-toolkit/core into enh/sc-map-scf-for-loops
…quantum-toolkit/core into enh/sc-map-scf-for-loops
Collaborator
Author
|
@coderabbitai full review |
Contributor
✅ Action performedFull review finished. |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@CHANGELOG.md`:
- Around line 45-46: The changelog entry currently groups `#1805` under the
initial infrastructure bullet, but it belongs with the place-and-route work.
Update the CHANGELOG.md release note so the reference to `#1805` is moved from the
initial infrastructure list to the existing place-and-route entry, keeping the
mapping aligned with the scf.for restoration support described by that PR.
In `@mlir/include/mlir/Dialect/QCO/Transforms/Mapping/Mapping.h`:
- Around line 27-29: The createMappingPass API currently takes only the coupling
edge set, which loses explicit qubit cardinality and breaks devices with
isolated qubits. Update the pass interface in Mapping.h so createMappingPass
preserves nqubits explicitly, or accepts a separate node set alongside the
DenseSet of couplings. Then propagate that preserved cardinality through the
mapping pass implementation so capacity checks and layout generation can still
account for disconnected qubits.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 338ea373-9f6e-4be1-8acd-5f865529457a
📒 Files selected for processing (15)
CHANGELOG.mdmlir/include/mlir/Dialect/QCO/Transforms/Mapping/Mapping.hmlir/include/mlir/Dialect/QCO/Utils/Algorithms.hmlir/include/mlir/Dialect/QCO/Utils/Drivers.hmlir/include/mlir/Dialect/QCO/Utils/Graph.hmlir/include/mlir/Dialect/QCO/Utils/Layout.hmlir/include/mlir/Dialect/QCO/Utils/Qubits.hmlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cppmlir/lib/Dialect/QCO/Utils/Algorithms.cppmlir/lib/Dialect/QCO/Utils/Graph.cppmlir/lib/Dialect/QCO/Utils/Layout.cppmlir/lib/Dialect/QCO/Utils/Qubits.cppmlir/lib/Dialect/QTensor/Utils/TensorIterator.cppmlir/unittests/Dialect/QCO/Transforms/Mapping/test_mapping.cppmlir/unittests/Dialect/QCO/Utils/test_drivers.cpp
💤 Files with no reviewable changes (6)
- mlir/lib/Dialect/QCO/Utils/Algorithms.cpp
- mlir/include/mlir/Dialect/QCO/Utils/Drivers.h
- mlir/include/mlir/Dialect/QCO/Utils/Qubits.h
- mlir/unittests/Dialect/QCO/Utils/test_drivers.cpp
- mlir/include/mlir/Dialect/QCO/Utils/Algorithms.h
- mlir/lib/Dialect/QCO/Utils/Qubits.cpp
Collaborator
Author
|
@coderabbitai full review |
Contributor
✅ Action performedFull review finished. |
Contributor
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp`:
- Around line 743-750: The unhappy-swap path in Mapping.cpp continues iterating
over the stale F-graph after curr is mutated, so later choices in the same pass
use outdated distances. Update the logic around the loop over f.getNodes() and
f.getNeighbours(u) to perform only the first eligible unhappy SWAP, then stop
the pass and rebuild f from the updated curr before any further swap selection.
Use the existing swap selection block and swaps bookkeeping to ensure the new
F-graph is always derived from the latest state.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: b6632d43-9dc0-4580-8fd2-bddc0b62283a
📒 Files selected for processing (15)
CHANGELOG.mdmlir/include/mlir/Dialect/QCO/Transforms/Mapping/Mapping.hmlir/include/mlir/Dialect/QCO/Utils/Algorithms.hmlir/include/mlir/Dialect/QCO/Utils/Drivers.hmlir/include/mlir/Dialect/QCO/Utils/Graph.hmlir/include/mlir/Dialect/QCO/Utils/Layout.hmlir/include/mlir/Dialect/QCO/Utils/Qubits.hmlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cppmlir/lib/Dialect/QCO/Utils/Algorithms.cppmlir/lib/Dialect/QCO/Utils/Graph.cppmlir/lib/Dialect/QCO/Utils/Layout.cppmlir/lib/Dialect/QCO/Utils/Qubits.cppmlir/lib/Dialect/QTensor/Utils/TensorIterator.cppmlir/unittests/Dialect/QCO/Transforms/Mapping/test_mapping.cppmlir/unittests/Dialect/QCO/Utils/test_drivers.cpp
💤 Files with no reviewable changes (6)
- mlir/include/mlir/Dialect/QCO/Utils/Algorithms.h
- mlir/lib/Dialect/QCO/Utils/Qubits.cpp
- mlir/lib/Dialect/QCO/Utils/Algorithms.cpp
- mlir/include/mlir/Dialect/QCO/Utils/Qubits.h
- mlir/include/mlir/Dialect/QCO/Utils/Drivers.h
- mlir/unittests/Dialect/QCO/Utils/test_drivers.cpp
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Changes
scf.foroperations and one unrolling unit test.Layoutclass to separate file.Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.