Skip to content

Fix: depth calculations for decompose gates#211

Merged
TheGupta2012 merged 4 commits intoqBraid:mainfrom
vinayswamik:bug/resolving-bugs2
Jun 24, 2025
Merged

Fix: depth calculations for decompose gates#211
TheGupta2012 merged 4 commits intoqBraid:mainfrom
vinayswamik:bug/resolving-bugs2

Conversation

@vinayswamik
Copy link
Copy Markdown
Collaborator

Fixes #201

Summary of changes

Added special handling for depth calculation for decompose gates

  • A new property decompose_gates was added to the QasmModule class to control whether gates should be decomposed during depth calculations.
  • This allows for more flexible depth calculations where users can choose whether to consider decomposed gates or not.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Member

@TheGupta2012 TheGupta2012 left a comment

Choose a reason for hiding this comment

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

Some minor comments @vinayswamik , but overall looks good! Bump CHANGELOG, as usual :)

@vinayswamik vinayswamik force-pushed the bug/resolving-bugs2 branch 2 times, most recently from 7a7c497 to 7eb9a62 Compare June 19, 2025 18:55
@TheGupta2012
Copy link
Copy Markdown
Member

Hi @vinayswamik , I don't see any new changes in the commit 7eb9a62, was it supposed to be like that?

- Introduced a new property in QasmModule to control gate decomposition during depth calculations.
- Added tests to validate depth calculations for decomposable gates
- Updated logic to increment qubit depth and reset counts only when not in a branching statement.
- Added a new test case to validate depth calculations for qubit resets within branching statements.
@vinayswamik vinayswamik force-pushed the bug/resolving-bugs2 branch from 7eb9a62 to 24e89a5 Compare June 22, 2025 18:46
@qBraid qBraid deleted a comment from github-actions bot Jun 22, 2025
- Refactored QasmVisitor to use `_decompose_native_gates` instead of `_decompose_gates`.
- Enhanced depth calculation for decomposable gates by ensuring accurate depth updates.
- Updated tests in `test_depth.py` and `test_depth.py` to reflect changes in depth calculation logic.
- Added a new test for custom decomposable gates to validate depth calculations.
- Updated QasmVisitor and QasmModule to replace decompose_gates with decompose_native_gates for depth calculations.
- Adjusted logic in QasmVisitor to ensure accurate depth updates for decomposable custom gates.
- Modified tests in test_depth.py and test_depth.py to reflect the new parameter and validate depth calculations for decomposable gates.
@vinayswamik vinayswamik requested a review from TheGupta2012 June 23, 2025 18:06
Copy link
Copy Markdown
Member

@TheGupta2012 TheGupta2012 left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@TheGupta2012 TheGupta2012 merged commit b0f0d2a into qBraid:main Jun 24, 2025
21 checks passed
@vinayswamik vinayswamik deleted the bug/resolving-bugs2 branch June 25, 2025 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Depth mismatch with QASM3 gates

3 participants