✨ Add optimal square-root iSWAP synthesis - #2468
Conversation
|
@coderabbitai full review |
✅ Action performedFull review finished. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (10)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe compiler adds Changes√iSWAP native gate support
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to The √iSWAP target support is internally consistent and no actionable merge-blocking risk is established. Sequence Diagram(s)sequenceDiagram
participant Target as CompilerTarget
participant Weyl as Weyl decomposition
participant Synthesis as Target-native synthesis
participant QCO as QCO operations
Target->>Target: Recognize sqrt_iswap capability
Synthesis->>Weyl: Decompose two-qubit unitary with SQRTISWAP
Weyl->>QCO: Emit XXPlusYY(-pi/2, 0)
Synthesis->>Target: Check parameters and placement
Target-->>Synthesis: Return support result
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 9 files. (1 skipped: 1 unsupported.) 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. A rabbit reviews the gates tonight Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
160ca7f to
6adde21
Compare
burgholzer
left a comment
There was a problem hiding this comment.
Pushed some very small adjustments here. Let's get this in 👍🏼
Synthesize numeric two-qubit blocks with zero to three square-root iSWAP gates and expose the fixed gate as a compiler target capability. Assisted-by: GPT-6 via Codex
Remove the added guide and glossary sections and modification comments. Assisted-by: GPT-6 via Codex
Keep two-qubit Weyl synthesis coverage in the existing test file. Assisted-by: GPT-6 via Codex
Keep the equation reference next to the interleaving rotations. Assisted-by: GPT-6 via Codex
Inline the margin calculation, shorten comments, and format the gate matrix by row. Assisted-by: GPT-6 via Codex
Remove the KAK alias from square-root iSWAP synthesis. Assisted-by: GPT-6 via Codex
Keep each matrix row on a separate line with row comments. Assisted-by: GPT-6 via Codex
Move the target enum check into the existing MLIR tests and leave gate-count and synthesis correctness coverage to C++. Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Use a rationalized half-angle formula to avoid cancellation near zero rotations. Resolve the clang-tidy diagnostics in synthesis and its tests. Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Preserve small interactions with stable beta extraction and use the analytic prefix instead of searching equivalent basis gates. Reuse matrix reconstruction and attach fixed-basis local factors directly. Repair native operand orientation without requiring a synthesis basis. Skip generic CX/CZ-cost fusion for this target to avoid increasing native gate counts, and document the per-unitary optimality limit. Leave the shared decomposition failure and fusion work to #2478. Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
Assisted-by: GPT-6 via Codex
5ef9c30 to
73508dc
Compare
🤖 AI text below 🤖
Description
Add
sqrt_iswapas a fixed two-qubit compiler target capability and exposeCompilerTarget.GateKind.SQRT_ISWAPin Python. A supplied numeric 4x4 unitary uses the minimum of zero to three square-root iSWAP gates within the Weyl interaction tolerance, preserving single-qubit factors and global phase. The compiler emitsxx_plus_yy(-pi/2, 0)and checks fixed parameters and ordered site placements. Existing entangler preferences are preserved.Use the analytic three-gate prefix instead of searching twelve candidates. Stable beta extraction preserves small interactions, while the existing CNOT boundary handling remains intact. Reuse the operation matrix and reconstruction helper; attach one-gate local factors directly. Constant-zero beta permits native operand reversal without requiring a single-qubit synthesis basis.
Optimality applies to one supplied unitary, not a whole program. The target pipeline skips generic CX/CZ-cost fusion when square-root iSWAP is the selected entangler: otherwise a circuit containing four native gates can grow to six. A full-pipeline regression protects this limit.
Reviewed #2478 before making these changes. Shared recoverable Weyl failures, quaternion/Euler stability, matrix caching, and the no-synthesis-basis fusion guard remain in that PR. This PR does not copy them or depend on its unmerged commits. Tests use current main's target-environment API. When the two PRs are combined, preserve #2478's recoverable-result contract and both fusion guards.
Validation
4c5e45855e5bb50c42b68ddbf4f9a4dababb8737; all rewritten commits and the fix commit are signed and verified.uvx nox -s lintandgit diff --check: passed.uvx nox -s cpp-lint -- 4c5e45855e5bb50c42b68ddbf4f9a4dababb8737: passed on the complete changed C++ files.uvx nox -s stubs: passed; regenerated stubs match the PR. Python smoke checks confirm the enum, recognized capability, and selected synthesis basis.Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).