Skip to content

✨ Add W-state preparation benchmark - #2542

Merged
denialhaag merged 5 commits into
mainfrom
codex/w-state-benchmark
Sep 25, 2026
Merged

denialhaag merged 5 commits into
mainfrom
codex/w-state-benchmark

Conversation

@burgholzer

@burgholzer burgholzer commented Sep 12, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Add W-state preparation to the existing C++, Python, and CLI benchmark interfaces. The generator keeps its controlled-RY/CX sweep in structured loops and computes each rotation angle inside the loop. The DD interpreter uses MLIR's existing constant folder to evaluate acos; no angle table is needed. Evaluation reuses the existing probability and counts APIs: each single-excitation outcome has ideal probability 1/n.

Based directly on current upstream main. This PR contains only the W-state addition, with no RTTI, exception-handling, or shared budget changes. Main already supports the counted loops used here; no changes from #2605 or dependency on #2545 are needed.

The 1,024-qubit regression checks jeff serialization, reload, and amplitudes through the existing DD simulator without dense extraction. Documentation includes executable 3- and 256-qubit examples.

Validation:

  • Optimized native build; 65 benchmark, 33 generation, and 200 QCO utility tests; benchmark CLI CTest.
  • 228 focused Python tests and regenerated stubs.
  • Full-file C++ lint against main, repository lint, and complete executable documentation with local link checks.

Codex assisted implementation, rebasing, validation, and this description.

Checklist

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

If PR contains AI-assisted content:

  • Any agent that created, edited, or submitted GitHub content was explicitly authorized for that scope, as required by our AI Usage Guidelines.
  • Every agent-authored or agent-edited public text body begins with the visible disclosure 🤖 *AI text below* 🤖 (titles are exempt).
  • I have disclosed AI assistance in the PR description.
  • I confirm that I have personally reviewed and understood all AI-generated content, and accept full responsibility for it.

@burgholzer burgholzer added documentation Improvements or additions to documentation feature New feature or request DD Anything related to the DD package c++ Anything related to C++ code python Anything related to Python code MLIR Anything related to MLIR labels Sep 12, 2026
@burgholzer burgholzer self-assigned this Sep 12, 2026
@burgholzer
burgholzer force-pushed the codex/w-state-benchmark branch from 53fa37d to 78a7fc6 Compare September 12, 2026 10:07
@codecov

codecov Bot commented Sep 12, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.44444% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/bench/JSON.cpp 89.5% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

@burgholzer burgholzer added this to the v4.1.0 - QDMI 1.4 / MQSF milestone Sep 12, 2026
@burgholzer
burgholzer force-pushed the codex/w-state-benchmark branch from 78a7fc6 to 3b68921 Compare September 12, 2026 11:10
@burgholzer burgholzer changed the title ✨ Add W-state benchmarks and coherent verification ✨ Add W-state preparation benchmark Sep 12, 2026
@mergify mergify Bot added the conflict label Sep 12, 2026
@burgholzer
burgholzer force-pushed the codex/w-state-benchmark branch from 3b68921 to 40a4d48 Compare September 14, 2026 19:34
@mergify mergify Bot removed the conflict label Sep 14, 2026
@burgholzer burgholzer added the fix Fix for something that isn't working label Sep 14, 2026
@burgholzer
burgholzer changed the base branch from main to codex/fix-mlir-exception-boundaries September 14, 2026 19:53
@burgholzer burgholzer removed the fix Fix for something that isn't working label Sep 14, 2026
@burgholzer
burgholzer force-pushed the codex/w-state-benchmark branch from 40a4d48 to 21d1baa Compare September 14, 2026 19:53
@mergify mergify Bot added the conflict label Sep 19, 2026
Prepare W states in structured loops and evaluate sampled counts against
analytic single-excitation probabilities. Register the family in the
existing C++, Python, and JSON interfaces.

Use main's existing compiler and simulation limits and retain the
4,096-qubit jeff round-trip and DD regression.

Assisted-by: Codex
@burgholzer
burgholzer changed the base branch from codex/fix-mlir-exception-boundaries to main September 23, 2026 11:00
@burgholzer
burgholzer force-pushed the codex/w-state-benchmark branch from 21d1baa to eb06b24 Compare September 23, 2026 11:00
@mergify mergify Bot added the conflict label Sep 23, 2026
Replace the angle tensor with scalar arithmetic and math operations.
Evaluate acos through the existing MLIR folder in the DD interpreter,
and remove the table-specific allocation limit and checks.

Keep the large jeff round-trip simulation at 1,024 qubits to reduce
routine test cost. Retain qubits as the parameter name used by GHZ,
QFT, and Multiplexer.

Assisted-by: Codex
@mergify mergify Bot removed the conflict label Sep 23, 2026
@burgholzer

Copy link
Copy Markdown
Member Author

@denialhaag This feels pretty straight-forward and a nice addition to the benchmarks. Also contains a bit of runtime math, which the entire toolchain can now handle 🙌🏼
I'll investigate whether we can drop the phase tables in a couple more of the algorithms to simplify the overall algorithm descriptions. Will file a follow up issue.

@denialhaag denialhaag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Some high-level feedback:

Comment thread bindings/bench/CMakeLists.txt Outdated
Comment thread bindings/bench/CMakeLists.txt
Comment thread bindings/bench/register_bench.cpp Outdated
Comment thread docs/benchmarks.md Outdated
Comment thread mlir/bench/programs/Programs.h Outdated
Comment thread mlir/unittests/bench/test_benchmark_cli.cmake Outdated
@denialhaag
denialhaag added this pull request to stack #2627 September 25, 2026 10:23

@denialhaag denialhaag left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@denialhaag denialhaag removed documentation Improvements or additions to documentation DD Anything related to the DD package labels Sep 25, 2026
@denialhaag
denialhaag merged commit 755e01f into main Sep 25, 2026
26 checks passed
@denialhaag
denialhaag deleted the codex/w-state-benchmark branch September 25, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Anything related to C++ code feature New feature or request MLIR Anything related to MLIR python Anything related to Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants