Skip to content

♻️ Extract native fixes and simplify test work - #2734

Merged
burgholzer merged 13 commits into
mainfrom
codex/extract-runtime-and-test-cleanup
Oct 10, 2026
Merged

burgholzer merged 13 commits into
mainfrom
codex/extract-runtime-and-test-cleanup

Conversation

@burgholzer

@burgholzer burgholzer commented Oct 10, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Extract independently useful fixes and simplifications from #2545 onto current main. Each change has its own commit; this PR does not depend on the exception replacement.

  • Preserve bare and uppercase DD imaginary-unit coefficients.
  • Reject zero allocation capacities in MemoryManager.
  • Handle terminal measurement fidelity and validate widths/permutation indices.
  • Report buffered DD file-write failures after closing the file.
  • Reuse ParsedBenchmark for JSON evaluation, preserving manifest validation and diagnostic order.
  • Check typed gate-parameter arity at compile time.
  • Remove the unused register-width argument from the MLIR DD adapter.
  • Bind JIT constructors/destructors to the session runtime and retain DDSIM output through teardown.
  • Query the existing functionality DD in the exhaustive Shor test instead of constructing and multiplying dense basis vectors.
  • Correct the documented benchmark-generator result type.
  • Execute DD documentation examples in a temporary directory.

Core's native throwing APIs remain. Source-tree MLIR callers use std::array for typed gate parameters and omit the unused adapter width. Result types, diagnostic adapters and exception policy remain in #2545.

CI investigation

The reported Windows failure occurred on main: SamplingRetainsStateWithoutChangingSamples reached 600 seconds. Successful previous main and #2545 suites took 76.73 and 78.29 seconds, respectively. These snapshots do not show a sustained exception-replacement regression. No root cause for the isolated hang was reproduced; host and worker stacks from a recurrence are still needed.

The Shor change preserves every modulus, multiplier, input and control case, plus the separate coherence, inverse and workspace checks. Matched Linux arm64/GCC 13.3 Release binaries, three runs each pinned to CPU 0, gave medians of 13.770 → 13.053 seconds. Ranges overlap (13.666–14.401 versus 12.524–14.211 seconds), so this is not a reliable CI speedup claim. Most duplicate tests previously removed from #2545 were never on main; no further deletion was justified without losing distinct coverage.

Validation

  • Release build and native suite: 4,014 tests, one existing skip.
  • Focused Python DD, benchmark, compiler and built-in driver tests: 455 passed.
  • Executable documentation and internal links passed.
  • Repository lint and whole-file C++ lint passed after fixing and rechecking the reported test-style findings.
  • Windows/macOS execution was not run locally. The buffered-write regression uses /dev/full where available.

Implemented with Codex assistance; human review remains required.

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.

🤖 *AI text below* 🤖

Parse bare and uppercase imaginary units accepted by DD serialization.
Keep the existing numeric parser and subnormal handling.

Assisted-by: Codex
🤖 *AI text below* 🤖

Enforce positive allocation sizes in MemoryManager before constructing
an empty slab that cannot grow. Cover direct and package callers.

Assisted-by: Codex
🤖 *AI text below* 🤖

Handle scalar DDs without dereferencing a terminal node. Reject outcome
widths and permutation indices that exceed the recursive representation.

Assisted-by: Codex
🤖 *AI text below* 🤖

Close serialized files before checking stream status so buffered write
errors reach callers. Retain the existing stream overload contract.

Assisted-by: Codex
🤖 *AI text below* 🤖

Evaluate through the existing ParsedBenchmark instance and case ID.
Avoid reparsing the envelope and remove duplicate evaluation dispatch
while preserving canonical-manifest checks and diagnostic precedence.

Assisted-by: Codex
🤖 *AI text below* 🤖

Keep typed QIR parameters in std::array and specialize the interpreter
factory using GateTable arity. Preserve ABI validation and semantic tests
while removing runtime checks from verified internal paths.

Assisted-by: Codex
🤖 *AI text below* 🤖

Run static constructors and destructors with the owning runtime bound.
Keep DDSIM capture streams alive and collect records after teardown.
Cover direct JIT state and primary/peer destructor output.

Assisted-by: Codex
🤖 *AI text below* 🤖

Read the expected entry from the functionality DD already built by the
exhaustive multiplier test. Preserve every input and the separate phase,
inverse, and workspace oracles.

Assisted-by: Codex
🤖 *AI text below* 🤖

Remove an ignored argument from the source-tree MLIR DD adapter and its
callers. Package construction and gate validation own the supported wire
range; retain those checks and the existing throwing result contract.

Assisted-by: Codex
🤖 *AI text below* 🤖

Describe the existing FailureOr result and source-build availability.
Keep the guide aligned with Generate.h without migration wording.

Assisted-by: Codex
🤖 *AI text below* 🤖

Run the executable DD guide in a temporary directory so rendered SVGs
do not enter the documentation source tree.

Assisted-by: Codex
@burgholzer burgholzer added code quality Code quality improvements fix Fix for something that isn't working c++ Anything related to C++ code labels Oct 10, 2026
@burgholzer burgholzer self-assigned this Oct 10, 2026
@burgholzer burgholzer added this to the v4.1.0 - QDMI 1.4 / MQSF milestone Oct 10, 2026
🤖 *AI text below* 🤖

The requested worker count is an upper bound. Count teardown output by
completed shots so smaller CPU budgets still verify all session output.

Repair the plan's accidental Markdown heading exposed by pre-commit.

Assisted-by: Codex
@burgholzer
burgholzer enabled auto-merge (squash) October 10, 2026 21:19
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@burgholzer
burgholzer merged commit 8943d52 into main Oct 10, 2026
26 checks passed
@burgholzer
burgholzer deleted the codex/extract-runtime-and-test-cleanup branch October 10, 2026 21:37
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 code quality Code quality improvements fix Fix for something that isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant