-
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
Certain build configurations are "less efficient" #76516
Comments
Tagging subscribers to this area: @hoyosjs Issue DetailsIssueThe repo has two main places where
To summarize, ExamplesIn the case of In the case of Solution -
|
Author: | tannergooding |
---|---|
Assignees: | - |
Labels: |
|
Milestone: | - |
Ultimately, I'd like to build "natively" for a given platform. So on Arm64 I should build for Arm64 and using the Arm64 tools that now exist by default. I should likewise build for x64 and using the x64 tools by default on x64; and for x86 and using the x86 tools by default on x86. Likewise, I'd prefer using native build tools for cross-compilation scenarios. So building for Arm64 on x64 should use the |
Related: #76079 |
I would like to build the runtime using the fastest compilers flavor available. One of the reasons behind the current setup is that |
The TL;DR is that across a range of computers/laptops I tested on, there is a slight to significant advantage for using the native tools, more-so when compiling for
The JIT itself builds using As for being faster, that's not really been the case for many years and you'll be hard pressed to find a scenario that shows x86 wins out in perf due to having half-width pointers. x64 does take 2x the space per pointer, but that is often offset due to having more registers and a more efficient calling convention, which ultimately can allow less overall memory access and less total computation. As for taking "less memory", this really depends. For processes that scale up to the number of cores, 4GB of RAM is restrictive on high end systems and can cause a lot of thrashing. When they scale out to multiple processes instead this is less of a concern. In our case, there isn't that measurable a difference because everything else is 64-bit already and the main .NET Host that is driving everything will sit between 2-10GB depending on which stage of the build it's doing (this is just for
As with anything "it depends". For debug/checked/release on Windows we're within the difference of milliseconds for just building Most of our memory consumption comes from the .NET Host which is 64-bit anyways and consumes somewhere between 5-10GB on my box. In the case of other more complex builds (like say building LLVM/Clang itself), their project is complex enough it requires a 64-bit host linker or it will OOM: https://clang.llvm.org/get_started.html (search for |
I do not see significant difference on my standard-issue HP desktop (Intel i9, 128GB). |
Issue
The repo has two main places where
vcvarsall.bat
is called and therefore where the C++ environment is setup. These are:To summarize,
vcvarsall.bat
allows a parameter in the form ofhost_target
and thereforex86_x64
ishost=x86, target=x64
.Examples
In the case of
init-vs-env
it defaults to assuming that thehost
(that is the machine we are building on) is alwaysx86
and therefore restricts us to using the 32-bit x86 versions of the compilers and related tools.In the case of
build-runtime
it has some complex handling that ultimately defaults tohost=x64, target=x64
and otherwise useshost=x86, target=*
where typicallytarget=%__HostArch%
.__HostArch
itself defaults to__TargetArch
unless the user passes in-hostarch *
.__TargetArch
matches the default-arch
command line passed in.Solution -
init-vs-env
For
init-vs-env
we should check%PROCESSOR_ARCHITECTURE%
and default back tox86
if unrecognized. This winds up with the most portability but also the least amount of emulation on platforms like Arm/Arm64. It likewise means we can make full advantage of modern build machines.Solution -
build-runtime
For
build-runtime
the fix should ultimately be similar. I don't think we need__HostArch
at all and instead should just detect it implicitly, requiring users to run the batch script from the correct command line environment.If we wanted to keep
__HostArch
, it should correctly default to matchingPROCESSOR_ARCHITECTURE
if otherwise unspecified. It should likewise be used for thehost
portion ofhost_target
.__TargetArch
should then be used for thetarget
portion.The text was updated successfully, but these errors were encountered: