[Build] enable IPO/LTO for release builds#11459
Open
Harmenszoon wants to merge 1 commit into
Open
Conversation
…O=OFF) Adds SC_ENABLE_LTO, default ON, and uses check_ipo_supported() to enable target-level IPO/LTO only for non-Debug configurations. Unsupported toolchains emit a status message and continue without IPO/LTO. Initial no-code A/B on MSVC 19.44.35217.0, CMake 3.31.6, Ninja, Release BUILD_GUI=OFF compared baseline /O2 /Ob2 /DNDEBUG against IPO /GL + /LTCG with threads=1 target_error=0 deterministic=1 fixed seed. DPS and TotalEvents matched exactly. Mean/median wins: CI_ST_10 5.48/6.23%; Windwalker DungeonSlice 9.26/10.65%; Windwalker ST 12.48/12.21%; Shadow Priest ST 10.40/10.35%; Havoc DH 5T 8.91/9.47%; Dev Evoker 5T 9.05/10.32%. Build time on that toolchain was 36.9s baseline vs 59.8s IPO. The full CI DungeonSlice profile was invalid because Demon Hunter disables that fight style by default (engine/class_modules/sc_demon_hunter.cpp:11273), so Windwalker DungeonSlice was used as the substituted control. Patched CMake validation using SC_ENABLE_LTO=OFF vs default ON remained output-equivalent: CI_ST_10 mean/median wins 3.74/4.63%; Windwalker ST 11.45/10.85%. The existing MSVC C4244 warning at engine/class_modules/sc_druid.cpp:8909 was unchanged.
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.
Summary
SC_ENABLE_LTOCMake option, default ONcheck_ipo_supported()and skip gracefully when IPO/LTO is unavailableengine,simc, andSimulationCraftWhy
CMake Release builds currently use the platform defaults only. On MSVC + Ninja this produced
/O2 /Ob2 /DNDEBUGwithout/GLor/LTCG. A no-code A/B showed that enabling CMake IPO/LTO produces output-equivalent sims with a consistent runtime win.Validation
Toolchain: Windows, MSVC 19.44.35217.0, CMake 3.31.6, Ninja,
BUILD_GUI=OFF.Initial no-code A/B, same source, baseline Release vs
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON,threads=1 target_error=0 deterministic=1 seed=123456 cleanup_threads=1, 5 interleaved repeats. DPS andTotalEventsmatched exactly in all valid cases.profiles/CI.simc iterations=10The requested full
profiles/CI.simc fight_style=DungeonSlicecontrol is invalid on this checkout because Demon Hunter disables DungeonSlice by default (engine/class_modules/sc_demon_hunter.cpp:11273), and the hintedenable_dungeon_slice=1is a Demon Hunter actor option rather than a global profile option. I used Windwalker DungeonSlice as the substituted DungeonSlice control.Final validation on this branch, based on current
origin/midnight(cfbfbe4):cmake -S . -B build-pr-lto-off -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=OFF -DSC_ENABLE_LTO=OFFcmake --build build-pr-lto-off --parallelcmake -S . -B build-pr-lto-on -G Ninja -DCMAKE_BUILD_TYPE=Release -DBUILD_GUI=OFFcmake --build build-pr-lto-on --parallelConfirmed
SC_ENABLE_LTO=OFFhas no/GLor/LTCG; default ON has/GLcompile flags and/LTCGlink flags. The existing MSVC warning atengine/class_modules/sc_druid.cpp:8909appears unchanged in both builds.Final A/B, 5 interleaved repeats:
profiles/CI.simc iterations=10Risk
-DSC_ENABLE_LTO=OFF.BUILD_GUI=OFF.