Skip to content

⚡ Optimize wheels and isolate native runtimes - #2715

Merged
burgholzer merged 3 commits into
mainfrom
codex/release-wheel-lto
Oct 9, 2026
Merged

burgholzer merged 3 commits into
mainfrom
codex/release-wheel-lto

Conversation

@burgholzer

@burgholzer burgholzer commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

🤖 AI text below 🤖

Description

Optimize portable release wheels and provide relocatable QDMI device bundles with a smaller native interface. This combines the build work and #2724 in one PR.

  • Build Linux wheels with Clang/LLD ThinLTO and macOS wheels with Apple Clang ThinLTO. Keep speed optimization in Python bindings, portable deployment settings in cibuildwheel/Slurm, and native CPU tuning for local source builds.

  • Keep native DD and device dependencies static. Python DD/MLIR modules share one private DD library; only the two DD-facing adapters compile separately. Wheels expose the QDMI C runtime and both native tools through CMake. Source installations provide the C++ SDK and static DD through the Development component.

  • Copy device libraries and declared worker/manifest/configuration files on incremental builds without relinking consumers. Preserve signing-aware macOS RPATH and Windows DLL names/locations. Private Python support libraries remain unexported.

  • Remove unused mqt-cc plugin exports, reuse the compiler context, and discard unused non-Debug link sections. Fold the benchmark launcher into _commands.py, centralize static export definitions, and test console entry points without private imports.

  • Keep MSVC IPO for production artifacts. Native MSVC test builds default IPO off because /GL libraries repeat code generation at every test link; -DENABLE_IPO=ON remains available explicitly. This addresses the native Windows build timeout with one default policy. Automatic-export DLLs still disable IPO because CMake cannot scan /GL objects.

  • Keep QIR C entry points noexcept, recover known allocation failures through existing error outputs, and contain other failures within the isolated worker.

  • Reject unavailable CMake components before importing targets so FetchContent can fall back to source. Honor installation and static-library switches, support native documentation builds, and enforce C++20 with extensions confined to the dependency that requires them. Resolve Windows DLL paths from the installed distribution.

  • Retain conditional uv caching for native sources, headers, TableGen, CMake, bundled data, and build settings; uncommitted docs, tests, Python, and stub edits do not rebuild the native package.

Size and performance

Measurements below are from the qualified 83be162a artifacts, before the subsequent native-test policy and build-infrastructure fixes. Repaired manylinux ARM64 wheel, with the same -O3/ThinLTO policy:

Artifact Before consolidation (#2724) Consolidated
Complete wheel 66.21 MiB 43.39 MiB
mqt-cc compressed 16.59 MiB 8.07 MiB
Benchmark command compressed 14.67 MiB 6.72 MiB
DDSIM worker compressed 24.09 MiB 18.38 MiB

Measured hosted standard wheels compared with the previous #2715 build without mqt-cc:

Platform Previous #2715 Consolidated
Linux ARM64 49.17 MiB 43.39 MiB
Linux x64 51.34 MiB 45.66 MiB
macOS ARM64 27.18 MiB 33.88 MiB
Windows x64 29.11 MiB 35.69 MiB
Windows ARM64 27.77 MiB 34.09 MiB

The complete ten-wheel set plus source distribution grows from 372.49 to 389.19 MiB (+4.48%), with mqt-cc included on every platform. macOS and Windows growth is approximately the compiler's compressed size; Linux discards enough unused code to more than recover that cost. No compiler features or worker isolation were removed. Two alternating 20-run compiler probes produced identical output: QFT48 to QIR median 88.2 → 86.3 ms; a 48-qubit layered circuit to optimized QCO 141.5 → 139.5 ms. These are local checks for regressions, not general performance claims.

Validation

  • Fixture cleanup on 7bf2fd800: removed the incremental test script and its consumer/input scaffolding. The existing eight runtime-file installation and configuration checks pass, as does repository lint. Ponytail review of the follow-up and connected build paths found no remaining actionable issues. Hosted checks for this revision are pending.
  • Local validation on 656af4bcc before fixture cleanup: 3,986 native tests passed with one existing skip; repository lint and the C++ lint session passed. Component fallback, optional components, native documentation, disabled installation with MLIR/bindings enabled, and incremental QDMI staging passed focused probes. Ad hoc incremental staging probes passed with Ninja and Ninja Multi-Config; the retained fixture covers installation and configuration validation. A 26-case uv probe verifies selective invalidation; Windows installation-path selection was checked with a mocked Windows API. Hosted Linux/macOS/Windows C++ and Python checks, the aggregate check, and Slurm integration passed for 656af4bcc.
  • The results below qualify earlier revisions; fresh platform wheels and native Windows/macOS execution have not been repeated for 656af4bcc.
  • CI on 593810944 passed every Linux/macOS/Windows C++ and Python job, lint, coverage collection, and the aggregate check. Documentation and Slurm integration also passed.
  • Windows x64 and ARM64 each passed 3,985 native tests with one unsupported-device skip. Cached builds took 1m30s and 1m59s respectively, with 94.92% compiler-cache hits; these are not clean-build benchmarks.
  • Wheel packaging passed on all five platforms, covering all ten wheels. These artifacts were built on 83be162a; 593810944 changed only the MSVC native-test IPO default and its documentation, with production settings unchanged.
  • Local ARM64 native release: 3,985 passed, one expected skip. Repaired manylinux wheel: 1,934 Python tests passed, two dependency/Python-version skips; auditwheel and strict abi3audit passed.
  • Console entry tests: 14 passed, with 100% Python line coverage for _commands.py. Separate subprocess smoke tests run both native tools.
  • C and C++ CMake runtime consumers without LLVM/MLIR, relocated DDSIM worker execution, SC configurations, and source static DD consumers with GCC 13/Clang 23 passed. Full executable documentation covered 18 notebooks and generated links.
  • Repaired Windows artifacts retain the three public import libraries. Device DLLs and the DDSIM worker have only platform runtime dependencies; native tools resolve private support DLLs beside their executables. Public driver/device exports contain only their C APIs.

AI assistance covered implementation, specialist build/package review, failure diagnosis, and validation. Human review is required before merging.

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 enhancement Improvement of existing feature continuous integration Anything related to the CI setup labels Oct 8, 2026
@burgholzer burgholzer self-assigned this Oct 8, 2026
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 83.46457% with 21 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
mlir/lib/Dialect/QIR/Execution/Runtime/QIR.cpp 80.1% 21 Missing ⚠️

📢 Thoughts on this report? Let us know!

@burgholzer
burgholzer marked this pull request as draft October 8, 2026 11:24
@burgholzer
burgholzer force-pushed the codex/release-wheel-lto branch from 4be0e1b to c9e4fc8 Compare October 8, 2026 21:19
@burgholzer burgholzer changed the title ⚡ Enable LTO for Linux release wheels ⚡ Optimize portable wheels with Clang and ThinLTO Oct 8, 2026
@burgholzer
burgholzer changed the base branch from main to codex/dd-concrete-operations October 8, 2026 21:19
@burgholzer
burgholzer marked this pull request as ready for review October 8, 2026 21:19
Base automatically changed from codex/dd-concrete-operations to main October 9, 2026 06:51
@mergify mergify Bot added the conflict label Oct 9, 2026
@burgholzer
burgholzer force-pushed the codex/release-wheel-lto branch from 8e308fd to fcf206a Compare October 9, 2026 10:27
@burgholzer
burgholzer force-pushed the codex/release-wheel-lto branch from fcf206a to d6d02f3 Compare October 9, 2026 10:50
@simon1hofmann
simon1hofmann added this pull request to stack #2721 October 9, 2026 11:49
@burgholzer
burgholzer force-pushed the codex/release-wheel-lto branch from d6d02f3 to 807f619 Compare October 9, 2026 11:49
@simon1hofmann simon1hofmann added this to the v4.1.0 - QDMI 1.4 / MQSF milestone Oct 9, 2026
@burgholzer
burgholzer force-pushed the codex/release-wheel-lto branch 2 times, most recently from be7a8e2 to 23fcc22 Compare October 9, 2026 15:28
@burgholzer
burgholzer force-pushed the codex/release-wheel-lto branch from 23fcc22 to 83be162 Compare October 9, 2026 17:58
@burgholzer burgholzer changed the title ⚡ Optimize portable wheels with Clang and ThinLTO ⚡ Optimize wheels and isolate native runtimes Oct 9, 2026
@burgholzer burgholzer added packaging Anything related to Python packaging QDMI Anything related to QDMI labels Oct 9, 2026
Use portable Clang/ThinLTO wheels and native source tuning. Keep MSVC IPO
for production artifacts; default native MSVC test builds to IPO off.
Discard unused release sections and remove unused compiler plugin exports;
reuse the compiler context and consolidate native command launchers.

Make native QDMI bundles self-contained with static implementation
libraries. Preserve one private shared DD for Python object exchange,
with only the two DD-facing MLIR adapters compiled separately.

Expose the QDMI C runtime and both native tools from wheels. Keep the C++
SDK and static DD in source installations with explicit Development
exports. Stage declared bundle files and preserve macOS signing paths.

Keep QIR C entry points noexcept, handle known allocation failures through
the existing output contract, and contain other failures in the worker.
Use portable deployment settings for Slurm's transported wheel.

Assisted-by: GPT-6 via Codex
@burgholzer
burgholzer force-pushed the codex/release-wheel-lto branch from 83be162 to 5938109 Compare October 9, 2026 18:48
Reject unavailable CMake components before importing targets so source
fallback remains usable. Stage QDMI bundles on incremental builds without
relinking consumers, and honor the installation switch throughout Core.

Keep conditional uv caching while tracking native build inputs and build
settings. Resolve Windows DLL paths through the installed distribution.
Honor static-library selection and strict C++20 settings, isolate the
Cap'n Proto extension requirement, and support native documentation builds.

Assisted-by: GPT-6 via Codex
Remove the incremental staging script, dummy consumer, copied input, and
test registration. Keep only the explicit installation settings needed by
the existing runtime-file installation and configuration checks.

Assisted-by: GPT-6 via Codex

@burgholzer burgholzer left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This revamps the CMake, installation, and wheel configuration for MQT Core. It also produces optimized wheels and should, as a result, boost performance.
Additionally, this PR now also ships mqt-cc as part of the PyPI wheel 🎉

@burgholzer
burgholzer merged commit 81c570c into main Oct 9, 2026
26 of 27 checks passed
@burgholzer
burgholzer deleted the codex/release-wheel-lto branch October 9, 2026 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

continuous integration Anything related to the CI setup enhancement Improvement of existing feature packaging Anything related to Python packaging QDMI Anything related to QDMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants