Skip to content

🐛 Fix DD and QIR inputs and simplify compiler helpers - #2731

Merged
burgholzer merged 9 commits into
mainfrom
codex/extract-core-fixes
Oct 10, 2026
Merged

burgholzer merged 9 commits into
mainfrom
codex/extract-core-fixes

Conversation

@burgholzer

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Extract nine independently useful fixes and simplifications from #2545 onto main after #2730, with one commit per change:

  • Validate LLVM modules and native QIR calling conventions, ABI attributes, and direct runtime call types before JIT execution.
  • Return compiler output-write failures without an LLVM stream-destructor abort.
  • Find provider resources beside libraries loaded by relative path.
  • Release scalar DD phase roots when interpretation fails.
  • Reject truncated DD records, invalid node references, and skipped vector levels while preserving matrix level skipping.
  • Remove failure propagation from infallible compiler helpers and simplify QCO yield binding.
  • Avoid repeated benchmark outcome validation and probability evaluation.
  • Parse benchmark specifications and compute canonical metadata once through the existing registry.
  • Include pass-pipeline parser details in the owning MLIR diagnostic.

The throwing APIs, optional LLVM/MLIR build, serialization format, and QIR runtime failure policy remain unchanged. The additive benchmark parsing API is documented in its public header. The larger dependency and error-handling migrations stay in #2545; no new dependency is added.

Review retained the existing DD parser and caught an overstrict QIR attribute check: function-level alignstack remains accepted, with a positive regression. Bug regressions reproduced failures before their fixes. DD changes address record structure and non-finite weights; broader numeric-normalization work is outside this extraction.

Validation on Linux AArch64 with LLVM/MLIR 23:

  • Release build and 4,004 runnable native tests passed.
  • Fresh no-MLIR build and 770 runnable tests passed.
  • Both native configurations skipped the existing unsupported job-ID test.
  • Fresh editable package and all 60 Python DD tests passed.
  • Repository lint and whole-file C++ lint passed (all 23 selected files, zero findings).

Windows and macOS require hosted CI. Codex assisted with extraction, review, tests, 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.

Reject truncated records, invalid node references, and missing vector
levels before constructing DD nodes. Preserve matrix level skipping,
subnormal weights, the serialization format, and throwing APIs.

Assisted-by: GPT-6 via Codex
A zero-qubit DD can still own a nontrivial phase weight. Release that
root on interpreter failure just as for states with qubits.

Assisted-by: GPT-6 via Codex
Use the executable-path fallback only when the anchor belongs to the
main executable. Relative shared-library paths must resolve beside
the loaded provider.

Assisted-by: GPT-6 via Codex
After reporting a write failure, clear the LLVM stream error so its
destructor does not abort instead of returning the existing failure
result.

Assisted-by: GPT-6 via Codex
Route parser details through the owning MLIR diagnostic so callers
receive the cause along with the failing pipeline.

Assisted-by: GPT-6 via Codex
Use void for helpers that cannot fail on supported verified IR.
Bind QCO yields directly to parent results and retain runtime lookup,
range, and arithmetic checks.

Assisted-by: GPT-6 via Codex
Let the probability function validate each outcome once and reuse its
result for modular-multiplier success scoring. Preserve count overflow,
empty-count, and malformed zero-count checks.

Assisted-by: GPT-6 via Codex
@burgholzer burgholzer added refactor Anything related to code refactoring fix Fix for something that isn't working labels Oct 10, 2026
@burgholzer burgholzer self-assigned this Oct 10, 2026
@codecov

codecov Bot commented Oct 10, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.29412% with 8 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/qdmi/common/DeviceConfiguration.cpp 42.8% 4 Missing ⚠️
src/bench/JSON.cpp 80.0% 2 Missing ⚠️
mlir/lib/Dialect/QIR/Execution/JIT/Session.cpp 97.2% 1 Missing ⚠️
src/dd/Serialization.cpp 97.7% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Reuse the JSON registry to return a typed benchmark and canonical
metadata in one parse. Remove the duplicate generation registry and
repeated case-ID hashing without adding an LLVM dependency.

Keep exception support enabled for generation so JSON validation errors
reach caller handlers with link-time optimization enabled.

Assisted-by: GPT-6 via Codex
Verify LLVM modules and reject incompatible calling conventions,
return/parameter ABI attributes, and direct runtime call types before
JIT execution. Preserve internal conventions, semantic attributes, and
the existing throwing runtime contract.

Assisted-by: GPT-6 via Codex
@burgholzer
burgholzer force-pushed the codex/extract-core-fixes branch from 4c4ab07 to 3dfed49 Compare October 10, 2026 11:54
@burgholzer burgholzer added this to the v4.1.0 - QDMI 1.4 / MQSF milestone Oct 10, 2026
@burgholzer
burgholzer merged commit da9ce44 into main Oct 10, 2026
27 checks passed
@burgholzer
burgholzer deleted the codex/extract-core-fixes branch October 10, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fix for something that isn't working refactor Anything related to code refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant