Repository navigation
⚡ Reduce QCO-to-QC conversion overhead - #2695
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
10 tasks done
simon1hofmann
marked this pull request as ready for review
October 7, 2026 08:03
simon1hofmann
force-pushed
the
codex/qco-conversion-performance
branch
from
October 7, 2026 11:43
416b19c to
d87fe7c
Compare
🤖 *AI text below* 🤖 Use no-rollback QCO-to-QC conversion and verify Core-owned Release pipelines at their boundaries. Keep per-pass verification in Debug and preserve caller-owned pass-manager settings. Add negative tests for invalid boundary IR and unsupported conversion. Focused measurements improve several cases but regress QuGAN; retain this as an experimental candidate pending broader validation. Assisted-by: Codex
🤖 *AI text below* 🤖 Keep runOnOperation protected, matching the MLIR pass interface and resolving the clang-tidy 23 diagnostic on the boundary-verification test. Assisted-by: Codex
🤖 *AI text below* 🤖 Keep this branch focused on no-rollback QCO-to-QC lowering. Move the boundary-verification policy and its tests to a separate draft so the conversion optimization can be reviewed without adopting that tradeoff. Assisted-by: Codex
Member
|
I'll rebase and review this next 😌 |
burgholzer
force-pushed
the
codex/qco-conversion-performance
branch
from
October 7, 2026 15:53
d87fe7c to
3418fc8
Compare
Contributor
Author
Sounds good. Me and @MatthiasReumann had some further ideas for improving the conversions quite substantially, but would create follow-ups for those. |
🤖 *AI text below* 🤖 Treat unrelated operations with legal operand and result types as legal so no-rollback conversion does not rewrite or fold classical IR. Remove the ineffective branch conversion pattern and its transform dependency; quantum branch operands remain unsupported. Cover classical branches, foldable LLVM comparisons, and rejected quantum branches. Document the conversion boundary and failure ownership. Assisted-by: Codex
🤖 *AI text below* 🤖 Remove branch fixtures that implied support for unstructured control flow, which target compilation already rejects and tests. Keep the straight-line folding regression and unsupported-consumer failure check. Drop the added pass documentation and explanatory comment rather than turning incidental conversion behavior into a public contract. Assisted-by: Codex
burgholzer
approved these changes
Oct 8, 2026
burgholzer
left a comment
Member
There was a problem hiding this comment.
Trimmed this down a bit while preserving the main speedup. Let's get this in.
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.
🤖 AI text below 🤖
Description
Reduce QCO → QC conversion overhead by applying rewrites immediately, releasing replaced operations and SSA uses as conversion progresses. Explicit legality for unchanged classical types avoids unnecessary folding; remove the unused branch conversion pattern and its transform dependency.
Regression coverage checks classical folding and unsupported quantum consumers. Existing target-pipeline tests cover rejection of unstructured control flow.
Benchmarks
Fresh native C++ measurements of
4916b0c1dagainst the conversion implementation at base3e8ba8b87. The earlier Mac harness and frozen imports were not available in this workspace; these runs use pinned Benchpress OpenQASM inputs and reconstructed targets on DGX Spark.Values are medians; BWT has only one pair. All matched output QC hashes and gate counts are identical. QuGAN's full-compilation median increased 4.1% despite its faster conversion phase; full times ranged from 6.28–7.86 s for baseline and 7.04–7.39 s for the PR. These measurements do not establish a general end-to-end speedup.
BWT whole-process peak RSS was 12.18 GiB for baseline and 8.01 GiB for the PR, including untimed import and serialization.
Method: DGX Spark pinned to ten Cortex-X925 cores; Clang 23,
-O3, ThinLTO, mold, LLVM/MLIR 23.1.0 with assertions enabled. Both executables use the same harness and common libraries; only the QCO-to-QC implementation differs. Serial fresh processes alternate variant order across pairs. The full timer includes QC copying, QC → QCO, target compilation, and return to QC, including API verification. Import, target setup, output verification, serialization, and hashing are outside the timer.Inputs and topology recipe: Benchpress
b695f30e8. BWT uses a symmetric 37-site line; QuGAN uses a symmetric 409-site heavy-hex graph. Native basis:id,sx,x,rz,cz, measurement, reset. QIR Base payload; seed 42, 10 mapping trials, 1 refinement iteration, lookahead 20. The synthetic case has one dynamic qubit and two million consecutive H gates; its timer includes conversion-boundary verification.Validation
4916b0c1d: 158 native conversion tests and 271 compiler tests passed.git diff --checkpassed.Codex assisted with implementation, review, tests, benchmark reruns, and this description. Human review remains required.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).