Repository navigation
✨ Add semiclassical Shor factoring benchmark - #2605
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Member
Author
|
@denialhaag this is pretty cool in my opinion and an even better showcase example than QPE. |
This was referenced Sep 23, 2026
denialhaag
reviewed
Sep 25, 2026
Implement bounded order finding, verified factor recovery, and the native and Python factoring workflow with executable documentation. Assisted-by: Codex
Use exact Fourier arithmetic and consistent result registers and examples. Admit FTQC-sized programs through higher import, unrolling, and execution budgets, with configurable boundaries and overflow checks. Apply the full complexity review while preserving jeff support. Assisted-by: Codex
Restrict the native sampled regression to 15 to avoid the coverage job's 600-second timeout. Keep 64 shots and the independent distribution check; the QIR and OpenQASM integration tests still factor both 15 and 21. Assisted-by: Codex
Assisted-by: GPT-6 Sol via Codex
Assisted-by: GPT-6 Sol via Codex
Assisted-by: GPT-6 Sol via Codex
denialhaag
force-pushed
the
codex/shor-benchmark
branch
from
September 25, 2026 10:15
ba5fd22 to
5ac0860
Compare
denialhaag
added this pull request to stack #2627
September 25, 2026 10:23
Assisted-by: GPT-6 Sol via Codex
Assisted-by: GPT-6 Sol via Codex
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
Add semiclassical Shor order finding with reusable controlled modular arithmetic and a C++/Python factoring driver.
shor.factor(21, run)generates order-finding circuits, verifies measured phases using exact continued fractions and gcds, retries bases when needed, and returns(3, 7). The callback controls compilation, device selection, shots, and execution seeds.The benchmark accepts odd moduli up to
2**31 - 1, uses2n+3qubits and2nphase bits inresult, and uses exact Fourier arithmetic. Generation builds polynomial-size arithmetic tables without computing the order classically. The factoring driver handles even numbers, primes, and perfect powers without quantum execution. The README and walkthrough run the same factoring-21 example through Adaptive QIR and OpenQASM 3.Raise QC import and payload-unrolling budgets to one billion operations, OpenQASM statement budgets to 100 million, and the DD conditional-loop budget to one billion iterations. The unrolling pass and native DD API expose budget overrides. Counted loops and total simulated gates remain uncapped; nesting, integer-width, and memory-safety checks remain separate. Mapped OpenQASM specializes physical-qubit indices; Adaptive QIR can retain indexed loops.
Fourier arithmetic is shared with the existing modular-multiplier benchmark. The benchmark uses the compiler contracts merged in #2546. Registry, JSON/CLI interfaces, Python bindings, generated stubs, and executable documentation are included.
Validation:
The 31-bit input bound is a representation limit, not a simulation-capacity promise. Large programs still require sufficient memory and execution time.
Simulation execution times (64 shots, median of three runs on one DGX Spark
Cortex-X925 core on the shared host; native Clang 23/ThinLTO DDSIM, including
import/JIT, excluding compilation):
Codex assisted with implementation, tests, documentation, and this description.
Checklist
If PR contains AI-assisted content:
🤖 *AI text below* 🤖(titles are exempt).