Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make -linkonce-templates less aggressive by default & add -linkonce-templates-aggressive #3924

Merged
merged 1 commit into from
Feb 28, 2022

Conversation

kinke
Copy link
Member

@kinke kinke commented Feb 27, 2022

Make -linkonce-templates not tamper with the general template emission algorithm anymore (so on top of default non-allinst or -allinst modes), and keep those tweaks as experimental -linkonce-templates-aggressive.

Compiling the druntime/Phobos unittests is only marginally slowed down compared to the more aggressive variant (~1.5% for debug, ~2.5% for release). It does show some rough 10% increase in required memory, but that's in line with non-linkonce-templates.

The more aggressive variant has the advantage of skipping needsCodegen() and potentially codegen'ing less symbols. The problem is that if an instantiated symbol isn't explicitly referenced, for instance a CRT ctor, it might not be codegen'd at all.

@kinke
Copy link
Member Author

kinke commented Feb 28, 2022

Runtimes and peak working sets (best-of-3) of /usr/bin/time -v ninja -j8 druntime-ldc-unittest[-debug] phobos2-ldc-unittest[-debug] on Linux x64, with an LLVM v13.0.1 without assertions:

debug release
normal 0:30.54, 2.29 GB 1:42.78, 2.12 GB
-linkonce-templates 0:30.28, 2.29 GB 1:17.86, 1.95 GB
-linkonce-templates-aggressive 0:29.91, 2.19 GB 1:17.34, 1.85 GB

…emplates-aggressive

Make -linkonce-templates *not* tamper with the general template
emission algorithm anymore (so on top of default non-allinst or
-allinst modes), and keep those tweaks as experimental
-linkonce-templates-aggressive.

Compiling the druntime/Phobos unittests is only marginally slowed
down compared to the more aggressive variant (~1.5% for debug,
~2.5% for release). It does show some rough 10% increase in required
memory, but that's in line with non-linkonce-templates.

The more aggressive variant has the advantage of skipping
needsCodegen() and potentially codegen'ing less symbols. The problem
is that if an instantiated symbol isn't explicitly referenced, for
instance a CRT ctor, it might not be codegen'd at all.
@kinke kinke disabled auto-merge February 28, 2022 23:10
@kinke kinke merged commit 4cbaebd into ldc-developers:master Feb 28, 2022
@kinke kinke deleted the linkonce branch February 28, 2022 23:10
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.

1 participant