This is an archive of the discontinued LLVM Phabricator instance.

[runtimes] Add a mechanism to use cache files for a runtimes build
ClosedPublic

Authored by smeenai on Aug 24 2023, 4:14 PM.

Details

Summary

Projects like libc++ include their own cache files, and it's convenient
to just be able to reuse those cache files as part of a runtimes build
instead of having to duplicate the settings inside a special runtimes
cache file (which will inevitably get out of sync).

I'm not completely happy about overloading the existing argument passing
behavior based on the argument name, but I also couldn't think of a good
alternative. Suggestions are welcome.

Diff Detail

Event Timeline

smeenai created this revision.Aug 24 2023, 4:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 4:14 PM
smeenai requested review of this revision.Aug 24 2023, 4:14 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2023, 4:14 PM

The fragments like https://github.com/llvm/llvm-project/blob/main/clang/cmake/caches/Fuchsia-stage2.cmake#L132-L184 and in particular https://github.com/llvm/llvm-project/blob/main/clang/cmake/caches/Fuchsia-stage2.cmake#L186-L289 have gotten quite unwieldy so I was already thinking about breaking those up into separate cache files and this feature is going to be needed so thank you!

The open question is if we should try and encourage developers towards using separate caches to the point where we can eventually completely deprecate and remove the support for passthrough or we want to be maintaining both forever?

Regarding the argument handling, I thought about alternatives but haven't come up with anything better. I have a question regarding the name though, we generally avoid the CMAKE_ prefixed variables to potential (future) collisions (for example for CMake starts using CMAKE_CACHES in the future). Perhaps we should call this something like LLVM_CACHE_FILES or just CACHE_FILES for simplicty?

The fragments like https://github.com/llvm/llvm-project/blob/main/clang/cmake/caches/Fuchsia-stage2.cmake#L132-L184 and in particular https://github.com/llvm/llvm-project/blob/main/clang/cmake/caches/Fuchsia-stage2.cmake#L186-L289 have gotten quite unwieldy so I was already thinking about breaking those up into separate cache files and this feature is going to be needed so thank you!

The open question is if we should try and encourage developers towards using separate caches to the point where we can eventually completely deprecate and remove the support for passthrough or we want to be maintaining both forever?

Hmm. I think separate cache files are going to be generally cleaner, but I can imagine cases where you only need to specify a couple of arguments and it's easier to inline them instead of creating a separate file. I think we can start with adding the support and converting our own runtimes build setups over and use that to get a sense of if there's still good use cases for separate passthroughs.

Regarding the argument handling, I thought about alternatives but haven't come up with anything better. I have a question regarding the name though, we generally avoid the CMAKE_ prefixed variables to potential (future) collisions (for example for CMake starts using CMAKE_CACHES in the future). Perhaps we should call this something like LLVM_CACHE_FILES or just CACHE_FILES for simplicty?

Good point, I'll change it.

smeenai updated this revision to Diff 554500.Aug 29 2023, 2:52 PM

Change to CACHE_FILES

phosek accepted this revision.Sep 16 2023, 5:34 PM

LGTM

This revision is now accepted and ready to land.Sep 16 2023, 5:34 PM
This revision was landed with ongoing or failed builds.Sep 18 2023, 12:19 PM
This revision was automatically updated to reflect the committed changes.