-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[Clang] Major build regression due to OOM on windows #119781
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
Comments
I'm bisecting this currently bisection log
It's down to one of Looking at the remaining commits, it's almost certainly due be2df95 (CC @chandlerc). I need to head out now, but will try later to confirm if a revert of that fixes things. |
Yeah it's probably that commit. What version of MSVC are you using? Most of versions seem to be OK with the new code, but some may struggle more with memory than others. There is one version of MSVC that seems to be miscompiling some of this code, and we're likely to temporarily revert until that miscompile is addressed. But eventually I'd really like to re-land this as it is a pretty significant improvement. I'll look into whether there is a viable way to reduce MSVC's memory usage here in the mean time, but I'm not sure... |
Thanks for the quick response!
We're using the newest VS2022, but currently targeting the VC 14.2 toolset (corresponding to VS2019). I can try if targeting VC 14.3 helps. |
This is definitely an area where I suspect MSVC's memory usage has improved substantially over time, and so using the later versions will help given how memory constrained the environment you're working in is. |
Note that #119638 reverted the code causing this, but not closing this issue because it may come back in that or a different form. |
Unfortunately, even VC v14.42 == VS v17.12 fails. IOW, there seems to be no currently available MSVC-based compiler that can handle this. |
With your memory limits... I'm not sure it's realistic to reliably remain under those kinds of limits. All but one version that we have build bots for were ok. |
8GB (+ more than that in swap) is not realistic anymore? We're not talking about a tiny embedded device here, but the default agent/VM of a major CI provider (GHA & Azure pipelines). In #112789, @nikic recently asked that building flang should not take more than 2GB per thread for it to be enabled by default. Presumably clang should respect similar limits? Even if we doubled that, it'd still be fine for us. But moving the minimum memory a factor 10 higher seems excessive (8GB main mem + ~16GB swap > 20GB). |
FWIW when building that commit with GCC there is no significant change to max-rss (it stays around 2GB). I don't have stats for a build using clang handy. I expect it would be possible to reduce the memory impact for MSVC a lot by directly generating the offsets using TableGen, so we don't have to generate a huge table via a constexpr function, which I assume is what trips up MSVC here. |
I have put together a patch series with a set of improvements built on the original PR that I think will drastically reduce the memory usage requirements: #120534 My experiments with Compiler Explorer seems to indicate that the The PR does a few things: it avoids the use of complex X-macro expansions to create the string literal, it reduces the number of string literal concatenations required, and it shrinks the largest of the string literals by a factor 3-ish. |
Closing this as the PR in question was reverted. I also tested a previous iteration of #120534 and it worked fine, so I'm hopeful that it will not regress again. Otherwise I can always reopen here. |
I've been building the LLVM 20 stack from
main
in conda-forge (mainly for testing #110217), and I've run into a regression that makes it impossible for us to build clang in our infrastructure. Granted, our free agents from azure-pipelines are quite puny (2 cores, 7-8GB memory, 6h time limit), but this has sufficed for many years to piece together LLVM, even though we have to slice things into several pieces (e.g. libllvm, clang, mlir, compiler-rt, libcxx, openmp, lld, etc.), both to stay under the 6h timeout, but also for packaging reasons.Following the various stages of #110217, I've built sets of packages based off the following commits:
(The ✅ / ❌ here only refer to building clang on windows, the other plaforms were fine)
After reproducing the problem 5+ times (happens 100% of the time), the failure looks as follows:
This is despite already using a ~16GB swapfile, and having reduced parallelism to
-j1
. It might be that somehing ininclude/clang/Basic/arm_sve_builtins.inc
goes haywire? I wasn't able to check as that file is generated and not checked-in.The problem is that we cannot even easily switch to compile with clang, because that creates a cycle from the POV of our build tool (clang building clang). Of course, that tool could be improved, and there are possible work-arounds, but it's still a pretty major regression IMO if even a single-threaded build cannot build
clang
with 8GB memory (+16GB swap) anymore.FWIW, our build looks roughly as follows (against an existing
libllvm
&libcxx
compiled from the same version or commit):The text was updated successfully, but these errors were encountered: