Kaboom: do not build it on a GCC that cannot instantiate it - #10
Merged
Conversation
Kaboom's port count is large enough that going through the boost.pfr aggregate fallback exhausts the compiler. g++-14 peaks at 40.9 GB and is OOM-killed; -fsyntax-only alone reaches 10 GB, so the cost is front-end instantiation and no optimisation flag reduces it (-O0, -O1, -fno-inline-functions, -finline-limit and the ggc params all behave identically). GCC only leaves that fallback with P1061 packs, i.e. g++ >= 16 built as C++26, where the same TU compiles in 151 s at 7.1 GB. Skip the object everywhere else rather than letting the build die. clang is unaffected: it has taken the structured path since 21. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ux7eanJYt46tkpQhitnk2r
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.
Compiling
Kaboom/Kaboom.hppwith GCC runs the compiler out of memory.It is the front end, not codegen
-fsyntax-onlyperforms no code generation at all, and still dies:-O3(40 GB cap)-O1(30 GB cap)-O0-O2-fno-inline-functions-finline-limit=100/=40--param inline-unit-growth=5 --param large-function-growth=20-O2 --param ggc-min-expand=10 --param ggc-min-heapsize=32768-fsyntax-onlyMemory grows ~9.4 GB/min, linearly. Since every optimisation level and every inliner knob behaves identically, and
-fsyntax-onlyreproduces it, this is template instantiation — nothing in the optimiser is involved and no flag can help.Cause and the one configuration that works
GCC < 16 has no P1061 structured-binding packs, so avendish selects the
boost.pfraggregate backend, and instantiating pfr over Kaboom's ~336-field aggregate is what exhausts the front end. Getting off pfr fixes it:gnu++23gnu++23gnu++23gnu++26So the guard tests the version and the standard: g++-16 in C++23 mode still selects pfr and still dies, so the version alone would not be a safe test.
clang is unaffected — it has been on the structured backend since 21, and the wasm lane (clang 23) selects it already at
gnu++23.Guard truth table, verified by evaluating the expression in CMake:
Companion fix in avendish, where g++-15 currently selects a backend it cannot compile: celtera/avendish#190