-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Most of libs partition is not incrementally buildable #49800
Comments
Tagging subscribers to this area: @Anipik, @safern, @ViktorHofer Issue DetailsRunning It looks like system which creates
|
From what I can see, the genpartialfacades target has inputs and ouputs but those me be invalidated. @agocke can you please share a binlog? |
Happy to share whatever info is necessary privately. If someone wants to look into this, feel free to reach out. |
We obviously want this to work and have spent time to make sure it works. Given how much we rely on ProjectReferences now, it makes incremental build especially important to inner-loop.
This is not the case. I did a small check on incremental build of System.Runtime.csproj and it does not invoke CSC at all, so something more subtle is happening. Perhaps the culprit is earlier in the build sequence (or even in scripts). |
So I tried this in the background today and found at least one culprit: runtime/src/libraries/shims/generated/Directory.Build.props Lines 30 to 36 in 0979434
This will cause the shims to rebuild every time, then trigger lots of downstream builds since many things get the shims from the ref-pack. I'll see if I can fix it. |
Looks like there's another problem with the shims: runtime/src/libraries/ref.proj Lines 82 to 89 in e01ffb9
Even if we fix the referencing between the shims we're force rebuilding them after all the other references are built. This is effectively a cycle since we put those in the reference pack. This rebuild is due to the netfx compat shims needing to have references to things outside of netcoreapp. Things outside netcoreapp now use the netcoreapp ref-pack to build. None of the projects that build in dotnet/runtime should require netfx compat shims, so we could exclude those from references to avoid retriggering builds. We can get netstandard out of that set since it doesn't need to reference anything outside netcoreapp. |
I agree, those should not be referenced and I was under the impression that those aren't by default as we define references granularly for .NETCoreApp configurations.
I agree and it would prefer to break the cycle either just locally or entirely if possible. Preferably we would not build these shims locally at all (and have a mode in the sfx projects to not error out if they are missing). I don't think we have any protection for these shims in place today, so I assume not building them locally would not add risk to the build? Alternatively if we believe the type forwards which are generated as part of a shims build don't change, should we just check them in, similar to #52793? AFAIK the compat shims only come into play when referencing a .NET Framework assembly (from .NET Standard or .NETCoreApp). Are we ok with freezing the current set of type forwards or do we want to continue live generating them based on available types on .NETCoreApp? |
Checking in the type-forwards doesn't solve anything here, unfortunately, as the process of generating them isn't causing any trouble here, it's the references that are changing. The type-forward generation task was just the first thing to notice that. If it didn't then the compile phase later on would notice it. The only way to remove that would be to compile from IL so that we wouldn't need references at all. I believe the way forward here is to:
|
From: @jkoritzinsky on #62444 It would be interesting to investigate using MSBuild static graph with the libraries build to see what improvements that provides if any. I think Viktor did some investigation a while back but I never saw the numbers. |
I just did a quick smoke run on my computer and incremental build takes 2mins, which for doing "nothing" is quite some time. |
This comment has been minimized.
This comment has been minimized.
@carlossanlop -- that's very different from incremental build. When we say "incremental build" we mean only build the things that changed and the components downstream of those. In particular if nothing changed, then nothing should rebuild (however the build needs to do some, ideally minimal, work to realize that). For argument validation that's probably a separate issue. To fix you can look at the eng\build.* scripts which are the main entry-point. |
I had some time during my vacation and stumbled upon this problem and submitted the following PRs to fix that:
I also filed dotnet/sdk#23517 which causes 111 seconds being spent on re-validating something that shouldn't run in an incremental no-op packaging operation. EDIT: Here are the remaining Top 10 running tasks: Summary:
|
@ViktorHofer can you get me a binlog from restore?
Then run no-op restore and send me |
@jeffkl you got mail 👍 What I forgot to mention in the mail is that you can clearly see in the "outer" binlog that the Restore target runs for ~16s where-as the "inner" static graph restore generated binlog shows a duration of only 12.5s which means that additional 3s are spent somewhere in between. IIRC the static graph restore happens out-of-process in a console app, so shelving out might contribute to the number. |
Well I think the long pole is how long its taking to evaluate the projects:
When I developed static graph-based restore, I was using a project tree with 750 projects which took 4 seconds to do a no-op restore. This repo is 1,686 projects and is taking 13.6 seconds (8ms per project on average). That is pretty darn fast in my opinion :) The NuGet side of things is only taking 3 seconds to determine that everything is up-to-date. MSBuild does not cache evaluations from build to build so I'm not sure how to make this faster. We'd have to look at evaluations to see if we could speed it up. Static graph-based restore disables globs (stuff like *.cs) so that's unlikely causing slowness. The evaluations and builds also very parallel but if the project tree's dependencies are in declared in such a way, we could see less parallelism. @rainersigwald what's your opinion, is there anything we can do to make evaluating 1,686 projects faster than 13 seconds? |
I don't think we actually have 1686 projects but 1686 evaluations (from both the inner and the outer dimensions). |
Thanks for double checking that restore itself isn't the culprit for slowness. I have some PRs in the pipeline that will reduce about 200 unnecessary outer builds by switching from TargetFrameworks to TargetFramework. |
Yes good point, 1,686 evaluations is what I meant |
Running
build clr+libs -ninja
and thenbuild libs -ninja
results in 217 csc invocations when there should be 0.It looks like system which creates
*.Forwards.cs
files may not be incremental.The text was updated successfully, but these errors were encountered: