Skip to content

🐛 Fix SSA Dominance Issues for Mapping Pass for Circuits With Barriers#1581

Merged
burgholzer merged 5 commits intomainfrom
bug/ssa-dominance-issues-mapping-pass-wireing
Mar 24, 2026
Merged

🐛 Fix SSA Dominance Issues for Mapping Pass for Circuits With Barriers#1581
burgholzer merged 5 commits intomainfrom
bug/ssa-dominance-issues-mapping-pass-wireing

Conversation

@MatthiasReumann
Copy link
Collaborator

@MatthiasReumann MatthiasReumann commented Mar 24, 2026

Description

This pull request fixes an issue which occurs when running the mapping pass on circuits using barriers.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • I have disclosed the use of AI tools in the PR description as per our AI Usage Guidelines.
  • AI-assisted commits include an Assisted-by: [Model Name] via [Tool Name] footer.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

@munich-quantum-toolkit munich-quantum-toolkit deleted a comment from coderabbitai bot Mar 24, 2026
@MatthiasReumann
Copy link
Collaborator Author

@coderabbitai full review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

✅ Actions performed

Full review triggered.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 24, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: af523fd0-64aa-418c-b7bb-cdb796c4e3d9

📥 Commits

Reviewing files that changed from the base of the PR and between 8d7cc71 and 65ee83d.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp
  • mlir/unittests/Dialect/QCO/Transforms/Mapping/test_mapping.cpp

📝 Walkthrough

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved handling of barrier operations in the place-and-route pass
    • Enhanced synchronization of multi-qubit gate advancement
  • Tests

    • Updated mapping tests to include barrier and measurement operations in generated sequences

Walkthrough

Updates changelog with PR #1581 reference, refactors QCO mapping pass wire traversal logic to handle barrier operations, introduces synchronization tracking for multi-qubit gate advancement, and updates corresponding test cases with barrier and measurement operations.

Changes

Cohort / File(s) Summary
Documentation
CHANGELOG.md
Added PR reference [#1581] to the place-and-route pass unreleased entry and corresponding link definition.
Mapping Pass Implementation
mlir/lib/Dialect/QCO/Transforms/Mapping/Mapping.cpp
Reintroduced TrialResult as a nested type, added SynchronizationMap helper for tracking operation iterators and refcounts, modified collectLayers wire traversal to explicitly handle BarrierOp, and updated commitTrial gate-advancement logic with ref-counted synchronization for multi-qubit operations.
Mapping Tests
mlir/unittests/Dialect/QCO/Transforms/Mapping/test_mapping.cpp
Updated IR validation walk to skip BarrierOp nodes and modified TEST_P(MappingPassTest, Sabre) to insert barrier and explicit measurement operations before deallocation.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • #1568 — Modifies mapping pass implementation and trial-related logic, including TrialResult and commit mechanics.

Suggested labels

fix

Suggested reviewers

  • burgholzer
  • ystade

Poem

🐰 A barrier rises in the mapping dance,
Synchronization gives the gates a chance!
Trials advance with careful count,
Wire by wire, the qubits mount. ⚛️

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 60.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main fix: SSA dominance issues for the mapping pass when circuits use barriers.
Description check ✅ Passed The description is minimal but covers the core issue, provides checklist confirmation, and discloses AI usage per guidelines.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bug/ssa-dominance-issues-mapping-pass-wireing

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Mar 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@MatthiasReumann MatthiasReumann self-assigned this Mar 24, 2026
@MatthiasReumann MatthiasReumann added c++ Anything related to C++ code MLIR Anything related to MLIR labels Mar 24, 2026
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks very clean. Just one brief comment. Feel free to ignore and merge.

@burgholzer burgholzer enabled auto-merge (squash) March 24, 2026 14:13
@burgholzer burgholzer merged commit a087c6c into main Mar 24, 2026
29 checks passed
@burgholzer burgholzer deleted the bug/ssa-dominance-issues-mapping-pass-wireing branch March 24, 2026 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code MLIR Anything related to MLIR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants