🐛 Fix linear typing violation in SCF conversion#1700
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
burgholzer
left a comment
There was a problem hiding this comment.
This LGTM. Let's see if the rabbit still finds something.
(We turned off automatic code reviews from CodeRabbit because we were frequently hitting rate limits)
📝 WalkthroughSummary by CodeRabbit
WalkthroughThis PR fixes a linear typing violation in QC-to-QCO conversion when using SCF operations. The fix refactors qubit insertion/extraction to skip qubits already required by the operation target, preventing duplicate qubit uses. Test coverage is expanded with separate variants for different qubit sourcing patterns. ChangesQC-to-QCO Linear Typing Fix
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
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/unittests/programs/qco_programs.h`:
- Around line 1043-1045: The API comment for
nestedForLoopCtrlOpWithExtractedQubit contains a duplicated word "the" ("where
the the qubit..."); edit the comment above the function declaration to remove
the extra "the" so it reads "where the qubit is extracted from the register."
and keep the rest of the sentence unchanged.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
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: 1bd1b969-bcaa-4447-8978-9e6b79421974
📒 Files selected for processing (10)
CHANGELOG.mdmlir/include/mlir/Dialect/QCO/Builder/QCOProgramBuilder.hmlir/lib/Conversion/QCToQCO/QCToQCO.cppmlir/lib/Dialect/QCO/Builder/QCOProgramBuilder.cppmlir/unittests/Conversion/QCOToQC/test_qco_to_qc.cppmlir/unittests/Conversion/QCToQCO/test_qc_to_qco.cppmlir/unittests/programs/qc_programs.cppmlir/unittests/programs/qc_programs.hmlir/unittests/programs/qco_programs.cppmlir/unittests/programs/qco_programs.h
| /// Creates a circuit with a for operation with a register and a qubit and a | ||
| /// nested ctrl operation where the the qubit is extracted from the register. | ||
| void nestedForLoopCtrlOpWithExtractedQubit(QCOProgramBuilder& b); |
There was a problem hiding this comment.
Fix duplicated word in the API comment.
Line 1044 says “where the the qubit…”. Please remove the duplicated “the”.
🤖 Prompt for 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.
In `@mlir/unittests/programs/qco_programs.h` around lines 1043 - 1045, The API
comment for nestedForLoopCtrlOpWithExtractedQubit contains a duplicated word
"the" ("where the the qubit..."); edit the comment above the function
declaration to remove the extra "the" so it reads "where the qubit is extracted
from the register." and keep the rest of the sentence unchanged.
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. An unexpected error occurred while generating fixes: Not Found - https://docs.github.com/rest/git/refs#get-a-reference |
Description
This PR modifies the insertion/extraction of qubits when a register is passed to an
scfoperation.Qubits that are passed along their origin register are not inserted into the register anymore to avoid linear typing violation.
Fixes #1699
Checklist
If PR contains AI-assisted content:
Assisted-by: [Model Name] via [Tool Name]footer.