✨ Map scf::WhileOps using the restore strategy#1911
Open
MatthiasReumann wants to merge 13 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
MatthiasReumann
marked this pull request as ready for review
July 17, 2026 06:50
Collaborator
Author
|
@coderabbitai full review |
Contributor
✅ Action performedFull review finished. |
Contributor
|
Caution Review failedAn error occurred during the review process. Please try again later. ✨ Finishing Touches✨ Simplify code
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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 `@mlir/unittests/Dialect/QCO/Transforms/Mapping/test_mapping.cpp`:
- Around line 107-127: Update the initialization in the mapping test around
initArgs, initialHardwareOrder, and localM so SCF hardware indices are derived
from qubit-only init operands, matching the filtered qubitArgs order. Filter
scf::WhileOp getInits() and scf::ForOp getInits() by QubitType before mapping
through m, while preserving qco::IfOp behavior and ensuring mixed-type loops do
not access missing DenseMap entries.
- Line 738: Add routing-relevant gates to the while after-region test around the
identity callback in the mapping test, so recursive after-region routing and
terminator realignment are exercised. Extend the test inputs and assertions to
verify the mapped values and control flow remain correctly aligned through the
after-region rather than merely returning args unchanged.
🪄 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: ce75cc65-da3f-4bff-a384-61ca652f1b74
📒 Files selected for processing (4)
mlir/include/mlir/Dialect/QCO/Utils/Drivers.hmlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cppmlir/lib/Dialect/QCO/Utils/WireIterator.cppmlir/unittests/Dialect/QCO/Transforms/Mapping/test_mapping.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.
Description
This pull request adds mapping support for the
scf::WhileOp.scf::WhileOpto supported SCF ops inMapping.cppscf::WhileOpisExecutablefunction intest_mapping.cppdispatchfunction inMapping.cppChecklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).Assisted-by: [Model Name] via [Tool Name]footer.