Repository navigation
fix(cmake): support LTO and Windows section elimination - #56
Merged
Merged
Conversation
iancris
approved these changes
Oct 13, 2026
jpgaribotti
approved these changes
Oct 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows consumers need the diffusion engine itself to participate in link-time optimization; optimizing only the addon wrapper leaves unused library code and data in the final binary.
Add an opt-in
SD_LTOsetting for the engine and embedded zip object library, with a configure-time IPO support check. On clang-cl, CMake selects ThinLTO. Package Windows release functions and data in individual sections using/Gyand/Gw, and document the matching ggml and final-link requirements. Existing optimization levels and default LTO behavior are preserved.This moves engine-owned settings out of the temporary qvac triplet in qvac #5007. Bare exports and final-addon linker settings remain in qvac. The registry must enable
SD_LTO=ONand ggml's existingGGML_LTO=ONfor the Windows build.Validation:
git diff --check; local Linux ARM64 CMake configuration with LTO on and off; built ggml-base and the zip object library with LTO enabled. The preceding equivalent compiler-flag experiment reduced the Windows addon from 91,430,912 to 83,512,320 bytes and passed 303 C++ tests (3 existing skips) and Windows desktop integration in qvac CI. Those measurements are from the triplet implementation; the relocated CMake settings still need Windows integration validation.Companion engine PR: qvac-ext-ggml #120.