-
Notifications
You must be signed in to change notification settings - Fork 25.4k
[cpp_wrapper] Build main and kernel code in separate threads #154551
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: gh/benjaminglass1/86/base
Are you sure you want to change the base?
[cpp_wrapper] Build main and kernel code in separate threads #154551
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/154551
Note: Links to docs will display an error until the docs builds have been completed. ✅ You can merge normally! (1 Unrelated Failure)As of commit 04c49e9 with merge base e785c08 ( UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
if _IS_WINDOWS: | ||
# https://learn.microsoft.com/en-us/cpp/build/walkthrough-compile-a-c-program-on-the-command-line?view=msvc-1704 | ||
# https://stackoverflow.com/a/31566153 | ||
cmd = ( | ||
f"{self._compiler} {self._include_dirs_args} {self._definitions_args} " | ||
f"{self._cflags_args} {self._sources_args} " | ||
f"{self._passthrough_parameters_args} {self._output}" | ||
) | ||
if self._do_link: | ||
cmd += ( | ||
f" /LD /link {self._libraries_dirs_args} {self._libraries_args} " | ||
f"{self._ldflags_args}" | ||
) | ||
if self._do_link: | ||
cmd += f" {ldflags_args} {libraries_args} {libraries_dirs_args}" | ||
return cmd | ||
|
||
command_line = format_build_command( | ||
compiler=self._compiler, | ||
sources=self._sources_args, | ||
include_dirs_args=self._include_dirs_args, | ||
definitions_args=self._definitions_args, | ||
cflags_args=self._cflags_args, | ||
ldflags_args=self._ldflags_args, | ||
libraries_args=self._libraries_args, | ||
libraries_dirs_args=self._libraries_dirs_args, | ||
passthrough_args=self._passthrough_parameters_args, | ||
output=self._output, | ||
return normalize_path_separator(cmd) | ||
|
||
cmd = ( | ||
f"{self._compiler} {self._sources_args} {self._definitions_args} " | ||
f"{self._cflags_args} {self._include_dirs_args} " | ||
f"{self._passthrough_parameters_args} {self._output}" | ||
) | ||
return command_line | ||
if self._do_link: | ||
cmd += ( | ||
f" {self._ldflags_args} {self._libraries_args} " | ||
f"{self._libraries_dirs_args}" | ||
) | ||
return cmd |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is functionally neutral; it just removes an interior function that added extra indentation and was only called here.
The main change of this commit is building cpp_wrapper code asynchronously, with a thread for the wrapper code, a thread for the kernel code, and a final thread to link. This improves build speeds, even while enabling an LTO link to improve performance. Additionally, significantly reduce the cold-start time for detecting compatible precompiled headers. We had accidentally preprocessed the underlying header in -O3, which is deeply unnecessary to simply detect content changes. ghstack-source-id: ad74c56 Pull Request resolved: #154551
The main change of this commit is building cpp_wrapper code asynchronously, with a thread for the wrapper code, a thread for the kernel code, and a final thread to link. This improves build speeds, even while enabling an LTO link to improve performance. Additionally, significantly reduce the cold-start time for detecting compatible precompiled headers. We had accidentally preprocessed the underlying header in -O3, which is deeply unnecessary to simply detect content changes. ghstack-source-id: ad74c56 Pull Request resolved: #154551
Looks like this PR hasn't been updated in a while so we're going to go ahead and mark this as |
Stack from ghstack (oldest at bottom):
The main change of this commit is building
cpp_wrapper
code asynchronously, with a thread for the wrapper code, a thread for the kernel code, and a final thread to link. This improves build speeds, even while enabling an LTO link to improve performance.Additionally, significantly reduce the cold-start time for detecting compatible precompiled headers. We had accidentally preprocessed the underlying header in
-O3
, which is deeply unnecessary to simply detect content changes.cc @voznesenskym @penguinwu @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @wenzhe-nrv @jiayisunx @ipiszy @chenyang78 @kadeng @muchulee8 @amjames @chauhang @aakhundov @coconutruben @Lucaskabela