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
CMake: Add optional precompiled header support #61940
Conversation
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. [ghstack-poisoned]
|
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. [ghstack-poisoned]
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. [ghstack-poisoned]
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. ghstack-source-id: 990b4e460433e89c5ebd6b3513e169cf495b8996 Pull Request resolved: #61940
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. [ghstack-poisoned]
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. ghstack-source-id: 21abe8f4cd9c8410c9835c42e92b7e6aa2fc4071 Pull Request resolved: #61940
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. [ghstack-poisoned]
This adds a `USE_PRECOMPILED_HEADERS` option to the CMake build which precompiles `ATen.h` and also `CUDAContext.h` for the cuda library. After making a change in `native_functions.yaml`, this speeds up compilation time by around 15% on my machine. ghstack-source-id: 04a91bc7298fff15e124d821e4cdf69bdc9b3bf2 Pull Request resolved: #61940
@malfet PTAL. |
option(USE_PRECOMPILED_HEADERS "Use pre-compiled headers to accelerate build. Requires cmake >= 3.16." OFF) | ||
if(USE_PRECOMPILED_HEADERS AND (CMAKE_VERSION VERSION_LESS "3.16")) | ||
message(FATAL_ERROR "Precompiled headers require cmake >= 3.16") | ||
endif() |
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.
Is there a reason not to turn it on by default?
option(USE_PRECOMPILED_HEADERS "Use pre-compiled headers to accelerate build. Requires cmake >= 3.16." OFF) | |
if(USE_PRECOMPILED_HEADERS AND (CMAKE_VERSION VERSION_LESS "3.16")) | |
message(FATAL_ERROR "Precompiled headers require cmake >= 3.16") | |
endif() | |
cmake_dependent_option(USE_PRECOMPILED_HEADERS "Use pre-compiled headers to accelerate build. Requires cmake >= 3.16." ON "CMAKE_VERSION VERSION_LESS 3.16" OFF) |
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.
I was just being conservative. There is an issue where the pch gets included everywhere, so it's possible for code to compile with PCH enabled but not without, and vice versa. It's also not necessarily a win on all machines, for example on a 32-core machine I see no benefit in overall compile times.
@malfet has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
This option was added in pytorch#61940 and fits with this section's theme of improving build times. I've also changed it to a `cmake_dependent_option` instead of `FATAL_ERROR`ing for older CMake versions.
Summary: This option was added in #61940 and fits with this section's theme of improving build times. I've also changed it to a `cmake_dependent_option` instead of `FATAL_ERROR`ing for older CMake versions. Pull Request resolved: #62827 Reviewed By: astaff Differential Revision: D30342102 Pulled By: malfet fbshipit-source-id: 3095b44b7085aee8a884ec95cba9f8998d4442e7
Stack from ghstack:
This adds a
USE_PRECOMPILED_HEADERS
option to the CMake build whichprecompiles
ATen.h
and alsoCUDAContext.h
for the cuda library.After making a change in
native_functions.yaml
, this speeds up compilationtime by around 15% on my machine.
Differential Revision: D29988775