Skip to content

Commit e890a23

Browse files
committed
[CI] Use ccache when prebuilding tests
Signed-off-by: Sarnie, Nick <[email protected]>
1 parent cb38c59 commit e890a23

File tree

4 files changed

+36
-7
lines changed

4 files changed

+36
-7
lines changed

.github/workflows/sycl-linux-build.yml

+4
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ jobs:
280280
binaries_artifact: ${{ inputs.e2e_binaries_artifact }}
281281
cxx_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
282282
extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd"
283+
build_cache_root: ${{ inputs.build_cache_root }}
284+
build_cache_suffix: "${{ inputs.build_cache_suffix }}_e2e"
283285

284286
- name: Remove E2E tests before spirv-backend run
285287
if: ${{ inputs.e2e_binaries_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
@@ -295,3 +297,5 @@ jobs:
295297
binaries_artifact: ${{ inputs.e2e_binaries_artifact }}_spirv_backend
296298
cxx_compiler: $GITHUB_WORKSPACE/toolchain/bin/clang++
297299
extra_lit_opts: --param spirv-backend=True
300+
build_cache_root: ${{ inputs.build_cache_root }}
301+
build_cache_suffix: "${{ inputs.build_cache_suffix }}_e2e_spv"

devops/actions/run-tests/e2e/action.yml

+27-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,12 @@ inputs:
1717
required: false
1818
cxx_compiler:
1919
required: false
20-
20+
build_cache_root:
21+
required: false
22+
build_cache_suffix:
23+
type: string
24+
required: false
25+
default: "default"
2126

2227
runs:
2328
using: "composite"
@@ -48,18 +53,36 @@ runs:
4853
env:
4954
CMAKE_EXTRA_ARGS: ${{ inputs.extra_cmake_args }}
5055
run: |
56+
CMPLR="${{ inputs.cxx_compiler || '$(which clang++)'}}"
5157
if [ -n "$CMAKE_EXTRA_ARGS" ]; then
5258
echo "opts=$CMAKE_EXTRA_ARGS" >> $GITHUB_OUTPUT
5359
fi
60+
if [ -n "${{ inputs.build_cache_root }}" ]; then
61+
CCACHE_PATH="$(dirname $CMPLR)"
62+
echo "CCACHE_COMPILER=clang++" >> $GITHUB_ENV
63+
echo "CCACHE_PATH=$CCACHE_PATH/real" >> $GITHUB_ENV
64+
echo "CCACHE_DIR=${{ inputs.build_cache_root }}/build_cache_${{ inputs.build_cache_suffix }}" >> $GITHUB_ENV
65+
echo "CCACHE_MAXSIZE=5G" >> $GITHUB_ENV
66+
#if [ ! -f "$CMPLR" ]; then
67+
# sudo ln -s "$(which ccache)" "$CMPLR"
68+
mkdir -p "$CCACHE_PATH/real"
69+
mv "$CMPLR" "$CCACHE_PATH/real"
70+
ln -s "$(which ccache)" "$CMPLR"
71+
#fi
72+
DPCPP_PATH="$(dirname $CCACHE_PATH)"
73+
echo "dpcpp_path=$DPCPP_PATH" >> $GITHUB_OUTPUT
74+
mkdir -p $CCACHE_DIR
75+
fi
76+
#todo fix dpcpp_path when not using ccache
77+
echo "CMPLR=$CMPLR" >> $GITHUB_ENV
5478
- name: Configure E2E tests
5579
if: inputs.testing_mode != 'run-only'
5680
shell: bash
5781
run: |
58-
cmake -GNinja -B./build-e2e -S./llvm/sycl/test-e2e -DCMAKE_CXX_COMPILER="${{ inputs.cxx_compiler || '$(which clang++)'}}" -DLLVM_LIT="$PWD/llvm/llvm/utils/lit/lit.py" ${{ steps.cmake_opts.outputs.opts }}
82+
cmake -GNinja -B./build-e2e -S./llvm/sycl/test-e2e -DCMAKE_CXX_COMPILER="$CMPLR" -DLLVM_LIT="$PWD/llvm/llvm/utils/lit/lit.py" ${{ steps.cmake_opts.outputs.opts }}
83+
echo "LIT_OPTS=-v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests --param print_features=True --param test-mode=${{ inputs.testing_mode }} --param sycl_devices=${{ inputs.target_devices }} --param dpcpp_path=${{ steps.cmake_opts.outputs.dpcpp_path }}" >> $GITHUB_ENV
5984
- name: SYCL End-to-end tests
6085
shell: bash {0}
61-
env:
62-
LIT_OPTS: -v --no-progress-bar --show-unsupported --show-pass --show-xfail --max-time 3600 --time-tests --param print_features=True --param test-mode=${{ inputs.testing_mode }} --param sycl_devices=${{ inputs.target_devices }} ${{ inputs.extra_lit_opts }}
6386
run: |
6487
ninja -C build-e2e check-sycl-e2e > e2e.log 2>&1
6588
exit_code=$?

sycl/test-e2e/lit.cfg.py

+2
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,8 @@ def open_check_file(file_name):
536536
lit_config.note("Targeted devices: {}".format(", ".join(config.sycl_devices)))
537537

538538
sycl_ls = FindTool("sycl-ls").resolve(llvm_config, config.llvm_tools_dir)
539+
print(llvm_config.__dict__)
540+
print(config.__dict__)
539541
if not sycl_ls:
540542
lit_config.fatal("can't find `sycl-ls`")
541543

sycl/test-e2e/lit.site.cfg.py.in

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import platform
66
import site
77

88
site.addsitedir("@CMAKE_CURRENT_SOURCE_DIR@")
9-
9+
print(lit_config.params)
1010
config.dpcpp_compiler = lit_config.params.get("dpcpp_compiler", "@SYCL_CXX_COMPILER@")
11-
config.dpcpp_root_dir= os.path.dirname(os.path.dirname(config.dpcpp_compiler))
12-
11+
config.dpcpp_root_dir = lit_config.params.get("dpcpp_path", os.path.dirname(os.path.dirname(config.dpcpp_compiler)))
12+
print(config.dpcpp_root_dir)
1313
config.llvm_tools_dir = os.path.join(config.dpcpp_root_dir, 'bin')
1414
config.lit_tools_dir = os.path.dirname("@TEST_SUITE_LIT@")
1515
config.dump_ir_supported = lit_config.params.get("dump_ir", ("@DUMP_IR_SUPPORTED@" if "@DUMP_IR_SUPPORTED@" else False))

0 commit comments

Comments
 (0)