Use precompiled headers for building libHalide#8999
Open
alexreinking wants to merge 5 commits intomainfrom
Open
Use precompiled headers for building libHalide#8999alexreinking wants to merge 5 commits intomainfrom
alexreinking wants to merge 5 commits intomainfrom
Conversation
a20cacf to
d8c6596
Compare
Member
Author
|
Windows doesn't like the HALIDE_EXPORT declarations in Error.h Meanwhile, there's all kinds of weird ODR issues cropping up elsewhere. Sigh -- I'll revisit after FetchContent is excised. |
mcourteaux
reviewed
Mar 10, 2026
d8c6596 to
4aabea5
Compare
Member
Author
|
The implementation here is pretty ugly because everything is just dumped into one big folder. If we had another subfolder for the LLVM-privileged sources, it would be easier to isolate the build rules. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces PCH support for building libHalide. It divides the sources into LLVM and non-LLVM parts; the former additionally precompiling our
LLVM_Headers.hheader.On my MacBook Pro M3 Max, this halves the compilation time from 50s to 25s on 18 threads. I hope this will bring a significant improvement, too.
In terms of total CPU time, I observed 1158s before this PR and 607s after, for a 48% net reduction in compilation time. Using Clang's
-ftime-reportsuggests that header parsing now accounts for only 27% (down from 63!) of the compilation time. Templates take 242s (40%) and the rest of the time is spent in the backend (200s / 33%).