Add PBC depth to resource-analysis JSON#2967
Open
sengthai wants to merge 24 commits into
Open
Conversation
jzaia18
reviewed
Jun 18, 2026
jzaia18
reviewed
Jun 18, 2026
jzaia18
reviewed
Jun 18, 2026
jzaia18
reviewed
Jun 18, 2026
Co-authored-by: Jake Zaia <23638795+jzaia18@users.noreply.github.com>
jzaia18
reviewed
Jun 18, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2967 +/- ##
=======================================
Coverage 96.97% 96.97%
=======================================
Files 166 166
Lines 19209 19209
Branches 1788 1788
=======================================
Hits 18628 18628
Misses 429 429
Partials 152 152 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rniczh
approved these changes
Jun 19, 2026
Co-authored-by: Hong-Sheng Zheng <mathan0203@gmail.com>
| auto d1 = computeBlockWorstCaseDepth(block, /*onlyOnDisjointQubit=*/true); | ||
| if (failed(d1) || *d1 == 0) { | ||
| return std::nullopt; | ||
| } |
Member
There was a problem hiding this comment.
why do we not care about skipDynamic in the else branch?
Contributor
Author
There was a problem hiding this comment.
skipDynamic doesn't matter in else branch. the reason is that whether skipDynamic changes anything depends only on whether the block contains a dynamic loop and that is completely independent of onlyOnDisjointQubit.
jzaia18
reviewed
Jun 25, 2026
jzaia18
reviewed
Jun 25, 2026
jzaia18
reviewed
Jun 25, 2026
jzaia18
reviewed
Jun 25, 2026
jzaia18
reviewed
Jun 25, 2026
jzaia18
reviewed
Jun 25, 2026
Co-authored-by: Jake Zaia <23638795+jzaia18@users.noreply.github.com>
- Update the PBCLayer API to hoist the onlyOnDisjointQubit and skipDynamic
jzaia18
reviewed
Jun 29, 2026
jzaia18
reviewed
Jun 29, 2026
Co-authored-by: Jake Zaia <23638795+jzaia18@users.noreply.github.com>
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.
Previously, the
resource-analysiscounts only gate and qubit number. The PBC depth analysis only exists inppm_specspass.In this PR, we add PBC depth (
any_commuting_depth/qubit_disjoint_depth) toresource-analysisJSON output. Also, report depth for both function bodies and lifted loop entries (for_loop_*,dyn_for_loop_*), same operation counts. For non-pbc circuit, thedepthvalue is empty.Note:
any_commuting_depth: the PPR/PPM that has non-overlapping qubit or commute to all gates in the layer.qubit_disjoint_depth: the PPR/PPM that has non-overlapping qubit to all gates in the layer.For the circuit something like this:
The output:
{ "circuit": { "depth": { "any_commuting_depth": 1, "qubit_disjoint_depth": 1 }, "var_function_calls": { "dyn_for_loop_1": "0x..." } }, "dyn_for_loop_1": { "depth": { "any_commuting_depth": 1, "qubit_disjoint_depth": 1 } } }See also: PennyLaneAI/pennylane#9703