-
Notifications
You must be signed in to change notification settings - Fork 14.8k
[LLVM] Remove explicit dependency on builtins build #159854
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
base: main
Are you sure you want to change the base?
Conversation
Summary: The LLVM runtimes build internally uses `ExternalProject_Add`. This then uses `BUILD_ALWAYS` to force the targets to be up-to-date when needed. One problem with this is that we have the builtins step and the runtimes step, which depends on the former. This means that when we build, we always touch the builtins, which then makes the runtimes stale. This patch tries to weaken that relationship by just getting rid of the explicit dependency. Because these targets are already `BUILD_ALWAYS` the compiler-rt target will always be built before the runtimes. This means it will always be available in-order when doing a normal build. What this patch changes is that now if someone makes a significant change to the `compiler-rt` runtime implementation it now may not trigger a rebuild of every single source file. I'm not sure if this behavior was here previously in the first place either, since it was just using a stale dependency and never did any extra work. I'm pretty sure most of the uses of the library are implicit through `clang` so it probably wouldn't track that dependency right anyway. I cold be wrong, but I'm hoping this resolves an issue I've had for a long time which makes it prohibitively difficult to use the runtimes interface with compiler-rt enabled as a runtime. Fixes: llvm#98897
Ping, I'm fairly certain this is equivalent to what we already do since the |
I don't know the compiler-rt/builtins system well enough to know whether theses dependencies can just be removed. Would't it be more elegant to avoid |
I tried that, but as far as I can tell the In practice if you remove BUILD_ALWAYS and modify the runtimes source, you will need to manually retrigger a build from the runtimes directory, the root one will just say 'no work to do'. |
I tried change locally and looked at the generated Ninja file but I don't see any dependency edge between I think the correct solution would be to avoid relying on |
Yeah, I'm going to assume that things in the
The problem is that the dependency edge is always considered stale. I suppose this method would let us correctly inform the step of dependencies without the build always functionality? I could try looking at it, because I'm eager to fix this since it has probably cost me literal days of unnecessary rebuild time as a trivial change that should take 2 seconds instead takes 90 seconds. |
I'm not sure separating the steps will help unless I'm missing something. The builtins and runtimes builds are part of the same build target as far as I know. The fundamental problem occurs because we cannot do proper dependency management between this barrier. Normally you'd have the runtimes depend on the builtins, but because of the BUILD_ALWAYS usage this is always out of date. You can get rid of |
Summary:
The LLVM runtimes build internally uses
ExternalProject_Add
. This thenuses
BUILD_ALWAYS
to force the targets to be up-to-date when needed.One problem with this is that we have the builtins step and the runtimes
step, which depends on the former. This means that when we build, we
always touch the builtins, which then makes the runtimes stale.
This patch tries to weaken that relationship by just getting rid of the
explicit dependency. Because these targets are already
BUILD_ALWAYS
the compiler-rt target will always be built before the runtimes. This
means it will always be available in-order when doing a normal build.
What this patch changes is that now if someone makes a significant
change to the
compiler-rt
runtime implementation it now may nottrigger a rebuild of every single source file. I'm not sure if this
behavior was here previously in the first place either, since it was
just using a stale dependency and never did any extra work. I'm pretty
sure most of the uses of the library are implicit through
clang
so itprobably wouldn't track that dependency right anyway.
I cold be wrong, but I'm hoping this resolves an issue I've had for a
long time which makes it prohibitively difficult to use the runtimes
interface with compiler-rt enabled as a runtime.
Fixes: #98897