Skip to content

Commit

Permalink
added ccache
Browse files Browse the repository at this point in the history
Signed-off-by: Elias Joseph <[email protected]>
  • Loading branch information
Elias Joseph committed Sep 9, 2024
1 parent 9dc6b90 commit fa5bf58
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/ci_linux_x64_clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ jobs:
needs: setup
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'linux_x64_clang')
runs-on: azure-linux-scale
container: ghcr.io/iree-org/cpubuilder_ubuntu_jammy_x86_64@sha256:ba10d33ef502d8b33aaa43800e640a6866983ef353b73fda2ed6595c4275e066
container:
# blobfuse requires the privileged flag
image: ghcr.io/iree-org/cpubuilder_ubuntu_jammy_x86_64@sha256:399feeba9bf396c3dbcb0a472acbe9ab8e25cab0f00867cd582da25cb1f39fcb
options: --privileged
defaults:
run:
shell: bash
Expand All @@ -42,9 +45,21 @@ jobs:
submodules: true
- name: Install Python requirements
run: python3 -m pip install -r ./runtime/bindings/python/iree/runtime/build_requirements.txt
- name: Setting up Cache
run: |
mkdir -p /mnt/azureblob
python3 ./build_tools/ccache/edit_fuse_connection.py ${{ secrets.AZURE_CCACHE_CONTAINER_KEY }}
blobfuse2 mount --allow-other --config-file=./build_tools/ccache/fuse_connection2.yaml /mnt/azureblob/
export CCACHE_DIR=/mnt/azureblob/ccache-container
# TODO(#18238): add local or remote ccache
- name: CMake - configure
run: |
export CCACHE_LOGFILE=ccache.log
export CCACHE_DEGUG=1
export SCCACHE_AZURE_CONNECTION_STRING=${{ secrets.AZURE_CCACHE_CONNECTION_STRING }}
export SCCACHE_AZURE_BLOB_CONTAINER="ccache-container"
cmake \
-G Ninja \
-B ${BUILD_DIR} \
Expand All @@ -54,12 +69,17 @@ jobs:
-DIREE_ENABLE_LLD=ON \
-DIREE_ENABLE_ASSERTIONS=ON \
-DIREE_BUILD_DOCS=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DIREE_TARGET_BACKEND_WEBGPU_SPIRV=ON
- name: CMake - build
run: |
ccache --zero-stats
ccache --show-stats
cmake --build ${BUILD_DIR} -- -k 0
cmake --build ${BUILD_DIR} --target install -- -k 0
cmake --build ${BUILD_DIR} --target iree-test-deps -- -k 0
ccache --show-stats
- name: Run CTest
run: ./build_tools/cmake/ctest_all.sh "${BUILD_DIR}"
- name: Test iree-dialects
Expand Down
13 changes: 13 additions & 0 deletions build_tools/ccache/edit_fuse_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import sys
import re

key = str(sys.argv[1])

f_ = open("build_tools/ccache/fuse_connection.yaml")
s = f_.read()
f_.close()

s = re.sub("CCACHE_KEY", key, s)
f_ = open("build_tools/ccache/fuse_connection2.yaml", "w+")
f_.write(s)
f_.close()
22 changes: 22 additions & 0 deletions build_tools/ccache/fuse_connection.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
logging:
type: syslog
level: LOG_INFO

components:
- libfuse
- attr_cache
- azstorage

libfuse:
path: /mnt/azureblob
allow-other: true

cap_add:
- SYS_ADMIN
devices:
- /dev/fuse

azstorage:
account-name: eliasteststorageaccount1
account-key: CCACHE_KEY
container: ccache-container
19 changes: 19 additions & 0 deletions build_tools/ccache/install_ccache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Copyright 2022 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

set -euo pipefail

CCACHE_VERSION="$1"

ARCH="$(uname -m)"

curl --silent --fail --show-error --location \
"https://github.com/ccache/ccache/releases/download/v${CCACHE_VERSION}/ccache-${CCACHE_VERSION}-linux-${ARCH}.tar.xz" \
--output ccache.tar.xz

tar xf ccache.tar.xz
cp ccache-${CCACHE_VERSION}-linux-${ARCH}/ccache /usr/local/bin

0 comments on commit fa5bf58

Please sign in to comment.