✨Map scf.for operations by restoration using the 4-approximation token swap algorithm#1805
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
|
@coderabbitai full review |
✅ Action performedFull review finished. |
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
|
@MatthiasReumann Just to double check given how there have been fairly recent pushes with changes here and the CI is failing: Is this PR ready for review? |
Sorry! Didn't check the pipeline yesterday anymore. Workflows seem to fail unexpectedly quite frequently recently. Anyway, this pull request is reviewable; yes 🙌 |
burgholzer
left a comment
There was a problem hiding this comment.
This generally looks really clean to me! I'm only have a couple of nitpicks and questions.
Co-authored-by: Lukas Burgholzer <burgholzer@me.com> Signed-off-by: matthias <matthias@bereumann.com>
burgholzer
left a comment
There was a problem hiding this comment.
Once the open conversations are resolved, feel free to merge this 🚀
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.