-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Improve coreclr windows native build time #33872
Comments
See #33510 (comment) |
With the changes @jkoritzinsky has to build using ninja I have managed to build the coreclr runtime under windows docker with a minimal vs installation. |
Docker files:
|
Note that "minimal" is still quite large... |
/cc @lpereira |
What is the "build-runtime.cmd" wall-clock time using msbuild vs. Ninja on Windows on the same machine?
I do not see this as a good reason. .NET Framework is going to be part of Windows forever. |
The benefit of using the msbuild generator is also that you can then open the generated solution / projects in visual studio with all the symbol definitions etc being correct, so intellisense can provide the best results. |
Visual Studio has support for opening CMake projects directly with their open-folder feature. We should investigate if that gives a comparable experience to the MSBuild projects for development. |
If not I do not mind living with multi project generators. |
Removing dependencies on Full framework in our build is general goodness. Reducing our dependencies in our build is a measurable goal that will hopefully enable us to use leaner windows docker files. Although I will admit, at the moment, until msvc supports installing outside vs, we still cannot fully drop the dependency. |
Right. Also, msvc and all other tooling we use on Windows would need to work on the leaner Windows images. That is a lot of problems to solve. |
Generally other build systems also come with additional dependencies and set of gotchas, e.g. arguments about meson and gyp being better than cmake, due to their leaner syntax etc., also do not always win due to their dependency on python, while cmake (with its share weaknesses) is (mainly) a build system for C/C++ project written in C/C++ without dozen of random dependencies. I do not feel strongly about ninja, but it itself being an additional dependency, and if there is no significant (or as @jkotas put, wall-clock time) improvement on Windows, then it is not quite appealing as advertised. At some point this option was added for Unix, but was phased out over time: Line 450 in fef9ca7
(and nobody seems to miss it, Mac build still takes < 5 minutes to compile the runtime native parts and scales out nicely to all available cores) |
Here is some preliminary timing data. TIme in minutes
|
Note that the timing data on the experiment brings it close to the linux build time |
That timing for an MSBuild clean build seems really fast. |
Will run 10 times and average. |
Also working on 2 core and 4 core vm build times. Will post probably early tomorrow. |
It would be nice if we also compare the degree of parallelism. Other build systems might be using higher |
SpeedupPercentage of how much faster the Ninja build is, compared to the msbuild generator.
|
@am11 the msbuild/ninja comparison is difficult entirely to compare in the way you are referring to because the msbuild generator has two levels of parallelization, the msbuild invocation and the cl invocations. Generally we choose to run msbuild serially, so that each vcxproj can run fan out in the native build of that proj. The largest downside to this is each vcxproj has to serially wait for the fan out and fan back to happen before running the next vcxproj build. The ninja generator does not have this problem, which is why it was interesting to prototype. |
What prevents us from choosing to run msbuild in parallel? |
We do run MSBuild in parallel. The current setup in master runs MSBuild and cl both in parallel. |
My information is old then thank you @jkoritzinsky :) This will certainly cause issues with over using the machine resources during the build then. As each msbuild will also pass maxcpucount to each vcxproj invocation. |
Is there a way to limit the number of processes msbuild spawns, regardless of GNU make has a command line parameter to specify that it shouldn't spawn new processes if the system load is beyond a certain threshold ( |
|
The problem is that we have a very weird balance between large vcxprojs and small vcxprojs, so we'd have to dynamically determine the best balance or do a ton of additional manual testing to figure out how to balance MSBuild parallelism with CL.exe parallelism. I've done tests, and doing one or the other causes a massive drop in build performance on an 8 core machine (40-50% time increase on the CoreCLR native build last time I tried). And honestly, I feel that the time investment spent on that to make it dynamically adjust correctly for the core count of the machine is a waste when we can instead switch to Ninja and significantly increase performance (with the 25-35% improvement as observed above) for significantly less work and more reliable results. |
Can we work with the msbuild and C++ teams to find the solution for this? I expect that number of other projects have the same problem. |
They are aware of the issue we face. /cc @jaredpar |
What's their recommendation to solve it? Do they plan to do anything about it? |
(Not sure which MSBuild issue to comment on.) At one time there was a prototype where MSBuild would dump the graph at the end of the build which could then seed choices in the next build. That seeding could maybe have been committed into the repo. Much of the time the scheduler has a whole bunch of projects to pick from to go next, but it doesn't know which depend on which, nor how large each is. If there are a small number of large, depended on projects, and lots of small, end of chain projects, the choices may have room for improvement. I am not sure whether they are considering that or whether the code has changed enough that it would be more work now than it was then. Also there is a big difference between a working prototype and a solid shippable feature. And I've no doubt the scheduler has approved substantially since back then. I think we had some simple heuristics in (such as prefer .proj over .*proj). But the coreclr problem reminded me of this approach. |
@jkoritzinsky can this be closed now that you merged in the Ninja support? |
Some ideas floating around are moving off of the msbuild cmake project generator and onto the ninja or nmake generators.
Moving off of the msbuild generator allows us to remove another full framework dependency in our build. In addition, this is an attempt to improve our native build parallelism on windows. This work will hopefully allow our native build on windows to compete with our linux builds.
This is related to #33510.
/cc @janvorli @jkoritzinsky @jkotas
The text was updated successfully, but these errors were encountered: