✨ Add inspection methods to QCProgram - #2149
Conversation
Assisted-by: Opus 5 via Claude Code
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
While working on this, I noticed that we have |
Assisted-by: Opus 5 via Claude Code
burgholzer
left a comment
There was a problem hiding this comment.
Just one fairly general observation while looking at this.
|
Follow-up thought from above: we likely also want further convenience functions for the programs
For straight-line programs, these are easy to compute. As soon as SCF is involved, it becomes much harder. Especially with loops. Should still be possible though. |
numTwoQubitGates method to QCProgramQCProgram
Good points! Progress: |
Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
…gates Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
|
🤖 AI text below 🤖 The gate-counting methods report static gate counts for the entry-point IR. They count gates in every SCF region once: both branches of |
…gates Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
|
@burgholzer, apart from the missing changelog entry, this should be ready now. I postponed the other two methods to a follow-up PR in case they require some more iteration. To save CI resources, I'm intentionally leaving the PR as a draft until we actually want to merge it. |
Assisted-by: GPT-5.6 Sol via Codex
Assisted-by: GPT-5.6 Sol via Codex
|
Important Approval pendingCodeRabbit has no unresolved comments, but it has not reviewed the latest commit. Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.
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 |
burgholzer
left a comment
There was a problem hiding this comment.
Pushed two simplification commits. Otherwise I think this can go in!
A thought that came to mind, but is not important for this PR is that we likely want to also introduce such functionality for QCO to inform some passes with quality metrics. That's a future topic though.
Description
🤖 AI text below 🤖
This PR adds inspection methods to
QCProgramthat are all exposed to Python.We need the functionality of counting two-qubit gates to benchmark
mqt-ccagainst other compilers inucc-bench.The methods count static gate occurrences in the entry-point IR. They count gates in each structured control-flow region once, regardless of how often the region executes. Operations within gate modifiers are not counted recursively, and barriers are skipped.
AI notice
This PR and its contents were created with the assistance of Opus 5 via Claude Code and GPT-5.6 Sol via Codex.
Checklist
I have added migration instructions to the upgrade guide (if needed).If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).