Skip to content
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

Add caching for submodules and CMake to Windows CI. #11906

Merged
merged 24 commits into from
Jan 23, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
45ee7ae
Add `IREE_USE_LOCAL_CCACHE` mode to setup_ccache.sh.
ScottTodd Jan 19, 2023
0a62623
Use actions/cache in build_test_runtime_windows job.
ScottTodd Jan 19, 2023
dd3b08a
Use actions/cache in build_test_all_windows job.
ScottTodd Jan 19, 2023
2c23f78
Remove other steps and short-circuit checks for testing.
ScottTodd Jan 19, 2023
cb4490c
Empty commit to test cache.
ScottTodd Jan 19, 2023
2007858
Try `CCACHE_COMPRESSLEVEL: 5`.
ScottTodd Jan 19, 2023
23aeb6a
Revert "Try `CCACHE_COMPRESSLEVEL: 5`."
ScottTodd Jan 20, 2023
56d4620
Zero stats in setup_ccache.sh.
ScottTodd Jan 20, 2023
f211318
Revert "Remove other steps and short-circuit checks for testing."
ScottTodd Jan 20, 2023
ee7f12d
Revert "Use actions/cache in build_test_runtime_windows job."
ScottTodd Jan 20, 2023
317a7bc
Add IREE_USE_CCACHE environment variable to simplify checks.
ScottTodd Jan 20, 2023
5352020
Add local read/write variables, adjust comments.
ScottTodd Jan 20, 2023
d475871
Test build_test_all_windows on presubmit (no cache writes).
ScottTodd Jan 20, 2023
e47e81a
fixup! Add IREE_USE_CCACHE environment variable to simplify checks.
ScottTodd Jan 20, 2023
f1626af
Disable other jobs, flip conditions for testing.
ScottTodd Jan 20, 2023
95a93cf
Empty commit to re-run CI with cache.
ScottTodd Jan 20, 2023
fa83e55
Set CCACHE_MAXSIZE to 3G.
ScottTodd Jan 20, 2023
31c524c
Revert "Disable other jobs, flip conditions for testing."
ScottTodd Jan 21, 2023
e5012e3
Tweak Docker comment.
ScottTodd Jan 21, 2023
0c85793
Always write to local cache.
ScottTodd Jan 21, 2023
597c956
Expand on cache comment.
ScottTodd Jan 21, 2023
201f014
Add DO NOT SUBMIT for running on postsubmit only.
ScottTodd Jan 21, 2023
150ee28
Cleanup before merge - disable presubmit, check before writing.
ScottTodd Jan 23, 2023
c935aef
Merge remote-tracking branch 'upstream/main' into ccache-windows
ScottTodd Jan 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,185 changes: 36 additions & 1,149 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build_tools/cmake/build_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ echo "Building sample deps"
echo "------------------"
"$CMAKE_BIN" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi
2 changes: 1 addition & 1 deletion build_tools/cmake/build_and_test_asan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ echo "Building microbenchmark suites"
echo "------------------"
"${CMAKE_BIN?}" --build "${BUILD_DIR?}" --target iree-microbenchmark-suites -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi

Expand Down
2 changes: 1 addition & 1 deletion build_tools/cmake/build_and_test_tsan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ echo "Building sample deps"
echo "------------------"
"$CMAKE_BIN" --build "${BUILD_DIR?}" --target iree-sample-deps -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi

Expand Down
2 changes: 1 addition & 1 deletion build_tools/cmake/build_android.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ echo "Building sample deps for device"
echo "------------------"
"${CMAKE_BIN}" --build "${BUILD_DIR}" --target iree-sample-deps -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi
2 changes: 1 addition & 1 deletion build_tools/cmake/build_host_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ declare -a CMAKE_ARGS=(
"${CMAKE_BIN}" "${CMAKE_ARGS[@]}"
"${CMAKE_BIN}" --build "${BUILD_DIR}" --target install -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi
2 changes: 1 addition & 1 deletion build_tools/cmake/build_runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ case "${BUILD_PRESET}" in
;;
esac

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi
2 changes: 1 addition & 1 deletion build_tools/cmake/build_runtime_emscripten.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ echo "Building sample deps"
echo "------------------"
"${CMAKE_BIN?}" --build . --target iree-sample-deps -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi
2 changes: 1 addition & 1 deletion build_tools/cmake/build_runtime_small.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ source build_tools/cmake/setup_ccache.sh
-DIREE_BUILD_COMPILER=OFF
"${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi
2 changes: 1 addition & 1 deletion build_tools/cmake/build_tracing.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ source build_tools/cmake/setup_ccache.sh
-DIREE_BUILD_COMPILER=OFF
"${CMAKE_BIN?}" --build "${BUILD_DIR}" -- -k 0

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
if (( IREE_USE_CCACHE == 1 )); then
ccache --show-stats
fi
43 changes: 39 additions & 4 deletions build_tools/cmake/setup_ccache.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,57 @@
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

# This file must be *sourced* not executed.
# ccache (https://ccache.dev/) setup, with read/write + local/remote options.
#
# Defaults to only reading from the shared remote cache (hosted on GCS) used by
# our Linux CI. The postsubmit CI writes to the cache, for presubmit CI and
# local builds to read from.
#
# Local caches can also be used to interface with external remote caches
# (like https://github.com/actions/cache) by
# 1. downloading the cache directory
# 2. sourcing with IREE_READ_LOCAL_CCACHE=1 IREE_WRITE_LOCAL_CCACHE=[0,1]
# 3. building with CMake
# 4. uploading the cache directory (if writing)
#
# Note: this file must be *sourced* not executed.

set -euo pipefail

# Configuration environment variables.
IREE_READ_REMOTE_CCACHE="${IREE_READ_REMOTE_CCACHE:-1}"
IREE_WRITE_REMOTE_CCACHE="${IREE_WRITE_REMOTE_CCACHE:-0}"
IREE_READ_LOCAL_CCACHE="${IREE_READ_LOCAL_CCACHE:-0}"
IREE_WRITE_LOCAL_CCACHE="${IREE_WRITE_LOCAL_CCACHE:-0}"

if (( ${IREE_WRITE_REMOTE_CCACHE} == 1 && ${IREE_READ_REMOTE_CCACHE} != 1 )); then
echo "Can't have 'IREE_WRITE_REMOTE_CCACHE' (${IREE_WRITE_REMOTE_CCACHE})" \
" set without 'IREE_READ_REMOTE_CCACHE' (${IREE_READ_REMOTE_CCACHE})"
fi
if (( ${IREE_WRITE_LOCAL_CCACHE} == 1 && ${IREE_READ_LOCAL_CCACHE} != 1 )); then
echo "Can't have 'IREE_WRITE_LOCAL_CCACHE' (${IREE_WRITE_LOCAL_CCACHE})" \
" set without 'IREE_READ_LOCAL_CCACHE' (${IREE_READ_LOCAL_CCACHE})"
fi

if (( IREE_READ_REMOTE_CCACHE == 1 || IREE_READ_LOCAL_CCACHE == 1 )); then
export IREE_USE_CCACHE=1
export CMAKE_C_COMPILER_LAUNCHER=$(which ccache)
export CMAKE_CXX_COMPILER_LAUNCHER=$(which ccache)
$(which ccache) --zero-stats
else
export IREE_USE_CCACHE=0
fi

if (( IREE_READ_LOCAL_CCACHE == 1 && IREE_WRITE_LOCAL_CCACHE == 0 )); then
export CCACHE_READONLY=1
fi

if (( IREE_READ_REMOTE_CCACHE == 1 && IREE_READ_LOCAL_CCACHE == 0 )); then
export CCACHE_REMOTE_ONLY=1
fi

if (( IREE_READ_REMOTE_CCACHE == 1 )); then
export CCACHE_REMOTE_STORAGE="http://storage.googleapis.com/iree-sccache/ccache"
export CCACHE_REMOTE_ONLY=1
export CMAKE_C_COMPILER_LAUNCHER=ccache
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
if (( IREE_WRITE_REMOTE_CCACHE == 1 )); then
set +x # Don't leak the token (even though it's short-lived)
export CCACHE_REMOTE_STORAGE="${CCACHE_REMOTE_STORAGE}|bearer-token=${IREE_CCACHE_GCP_TOKEN}"
Expand Down