iree-org / iree

A retargetable MLIR-based machine learning compiler and runtime toolkit.
http://iree.dev/
Apache License 2.0
2.58k stars 579 forks source link

Experiment with cache settings across CI workflows #18185

Open ScottTodd opened 1 month ago

ScottTodd commented 1 month ago

I've switched several CI workflows from using remote ccache storage in a GCS bucket to using "local" ccache storage in GitHub Actions caches, mainly by using https://github.com/hendrikmuhs/ccache-action. A few adjustments to the caching strategy could save minutes per workflow run.

Note that Bazel uses a global mutable cache (i.e. shared across many commits): https://bazel.build/remote/caching. The default way to use ccache with GitHub Actions from that ccache-action creates immutable cache entries and cache hits within a build are unlikely if the selected cache entry was from a substantially different commit (such as whenever the LLVM commit pin changes).

Experiments to try:

makslevental commented 1 month ago

I'll add my own idea here: somehow orchestrate runners to run distcc/icecream.

makslevental commented 1 month ago

Just jotting this down for posterity/future reference; these settings seem to universally beneficial for increasing hits:

echo CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros >> $GITHUB_ENV

while this setting

echo CCACHE_COMPILERCHECK=content >> $GITHUB_ENV

only helps on linux and windows but on mac has the opposite effect (increasing misses), even though it's supposed to also work there as well.

In general you can set CCACHE_COMPILERCHECK to string:<IDSTRING> (see here) and probably a good candidate for <IDSTRING> is the output of clang -v (or whatever).