Skip to content

Filter backend-owned runtime DLLs#115

Merged
leehack merged 1 commit into
mainfrom
filter-backend-runtime-dlls
May 8, 2026
Merged

Filter backend-owned runtime DLLs#115
leehack merged 1 commit into
mainfrom
filter-backend-runtime-dlls

Conversation

@leehack

@leehack leehack commented May 6, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #114.

This PR filters backend-owned runtime dependencies during native asset bundling. CUDA runtime DLLs are now emitted only when the cuda backend module is selected, and OpenBLAS runtime libraries are emitted only when blas is selected.

Unknown non-core runtime libraries are still bundled by default for compatibility with future native bundle layouts.

Root Cause

CUDA runtime DLLs such as cudart64_12.dll, cublas64_12.dll, and cublaslt64_12.dll intentionally have backend == null so they do not make CUDA appear available unless ggml-cuda is present. The bundling filter previously treated all backend == null non-core libraries as always-keep runtime files, so those CUDA DLLs leaked into Windows packages even when CUDA was not selected.

Changes

  • Adds hook-layer classification for known backend-owned runtime dependencies without changing backend availability detection.
  • Filters CUDA runtime DLLs based on cuda selection.
  • Filters OpenBLAS runtime libraries based on blas selection.
  • Keeps unknown runtime libraries bundled for forward compatibility.
  • Adds README, docs-site, and changelog notes for the packaging behavior.

Validation

  • dart test -p vm test/unit/hook/native_bundle_config_test.dart
  • dart test -p vm test/unit/hook/build_hook_integration_test.dart
  • dart analyze

@leehack leehack force-pushed the filter-backend-runtime-dlls branch from d15c240 to 3918bd1 Compare May 6, 2026 13:13
@leehack leehack marked this pull request as ready for review May 6, 2026 13:13
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.59%. Comparing base (5a138a2) to head (3918bd1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
+ Coverage   76.57%   76.59%   +0.02%     
==========================================
  Files          68       68              
  Lines        8670     8678       +8     
==========================================
+ Hits         6639     6647       +8     
  Misses       2031     2031              
Flag Coverage Δ
unittests 76.59% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Windows native packaging bloat by filtering “backend-owned” runtime dependencies during native asset bundling so CUDA/OpenBLAS runtime libraries are only emitted when their owning backend module is selected, while still bundling unknown non-core runtime libraries for forward compatibility.

Changes:

  • Added explicit classification for known backend-owned runtime dependencies (CUDA runtimes and OpenBLAS) without changing backend availability detection.
  • Updated bundling selection logic to filter these runtime dependencies based on the user-selected backends.
  • Added/updated unit + integration tests and documented the new packaging behavior in README/docs/changelog.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
website/docs/platforms/support-matrix.md Documents backend-owned runtime dependency bundling behavior.
website/docs/changelog/recent-releases.md Notes the new bundling behavior in the docs changelog.
test/unit/hook/native_bundle_config_test.dart Adds coverage for filtering/keeping CUDA & OpenBLAS runtime dependencies based on selected backends.
test/unit/hook/build_hook_integration_test.dart Verifies the build hook does not emit CUDA DLLs unless cuda is selected.
README.md Documents backend-owned runtime dependency bundling rules for users.
lib/src/hook/native_bundle_config.dart Implements runtime dependency classification and selection-time filtering.
CHANGELOG.md Records the packaging size fix in the main changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@leehack leehack merged commit a6305cd into main May 8, 2026
10 checks passed
@leehack leehack deleted the filter-backend-runtime-dlls branch May 8, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows build bundles CUDA DLLs despite backends: [vulkan, cpu] configuration

3 participants