Skip to content

Commit 36dbfec

Browse files
committed
Use unified runtime built on test machine
1 parent cf844bc commit 36dbfec

2 files changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,14 @@ on:
144144
required: False
145145
default: ''
146146

147+
build_unified_runtime_locally:
148+
description: |
149+
If true, build unified-runtime locally using the container's CUDA
150+
toolkit instead of using the prebuilt adapter from the toolchain.
151+
type: string
152+
required: False
153+
default: 'true'
154+
147155
in_workflow_call_mode:
148156
description: |
149157
Unlike `github.event_type` that captures the original trigger, we use
@@ -344,6 +352,7 @@ jobs:
344352
target_devices: ${{ inputs.target_devices }}
345353
extra_lit_opts: ${{ inputs.extra_lit_opts }}
346354
retention-days: ${{ inputs.retention-days }}
355+
build_unified_runtime_locally: ${{ inputs.build_unified_runtime_locally }}
347356

348357
- name: Run SYCL CTS Tests
349358
if: inputs.tests_selector == 'cts'

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

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ inputs:
1818
required: false
1919
sycl_compiler:
2020
required: false
21+
build_unified_runtime_locally:
22+
required: false
23+
default: 'true'
2124

2225

2326
runs:
@@ -52,6 +55,78 @@ runs:
5255
tar -I 'zstd' -xf /sycl-prebuilt/e2e_binaries.tar.zst -C build-e2e
5356
tar -I 'zstd' -xf /sycl-prebuilt/e2e_sources.tar.zst -C llvm
5457
58+
- name: Checkout unified-runtime source
59+
if: inputs.build_unified_runtime_locally == 'true'
60+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
61+
with:
62+
path: unified-runtime-src
63+
sparse-checkout: |
64+
unified-runtime/
65+
ref: ${{ inputs.ref || github.sha }}
66+
67+
- name: Provide lit binary for UR tests
68+
if: inputs.build_unified_runtime_locally == 'true'
69+
shell: bash
70+
run: |
71+
if command -v lit >/dev/null 2>&1; then
72+
exit 0
73+
fi
74+
75+
mkdir -p "$HOME/.local/bin"
76+
77+
if [ -x "$PWD/toolchain/bin/llvm-lit" ]; then
78+
ln -sfn "$PWD/toolchain/bin/llvm-lit" "$HOME/.local/bin/lit"
79+
echo "$HOME/.local/bin" >> $GITHUB_PATH
80+
exit 0
81+
fi
82+
83+
if command -v llvm-lit >/dev/null 2>&1; then
84+
ln -sfn "$(command -v llvm-lit)" "$HOME/.local/bin/lit"
85+
echo "$HOME/.local/bin" >> $GITHUB_PATH
86+
exit 0
87+
fi
88+
89+
python3 -m pip install --user lit
90+
echo "$HOME/.local/bin" >> $GITHUB_PATH
91+
92+
- name: Build unified-runtime with container CUDA
93+
if: inputs.build_unified_runtime_locally == 'true'
94+
shell: bash
95+
run: |
96+
cd unified-runtime-src
97+
ln -sfn "$PWD/../toolchain" dpcpp_compiler
98+
cmake -S unified-runtime -B build \
99+
-DCMAKE_C_COMPILER=gcc \
100+
-DCMAKE_CXX_COMPILER=g++ \
101+
-DCMAKE_BUILD_TYPE=Release \
102+
-DUR_ENABLE_TRACING=ON \
103+
-DUR_DEVELOPER_MODE=ON \
104+
-DUR_BUILD_TESTS=ON \
105+
-DUR_BUILD_ADAPTER_L0_V2=ON \
106+
-DUR_STATIC_LOADER=OFF \
107+
-DUR_STATIC_ADAPTER_L0_V2=OFF \
108+
-DUR_DPCXX=./dpcpp_compiler/bin/clang++ \
109+
-DUR_SYCL_LIBRARY_DIR=./dpcpp_compiler/lib \
110+
-DUR_CONFORMANCE_NVIDIA_ARCH="sm_75" \
111+
-DCMAKE_INSTALL_PREFIX=./install
112+
cmake --build build
113+
cmake --install build
114+
115+
- name: Install built unified-runtime
116+
if: inputs.build_unified_runtime_locally == 'true'
117+
shell: bash
118+
run: |
119+
# Install the locally-built UR libraries over the prebuilt ones
120+
mkdir -p "$PWD/toolchain/lib/plugins"
121+
cp unified-runtime-src/install/lib/libur_adapter_cuda.so* "$PWD/toolchain/lib/" 2>/dev/null || true
122+
cp unified-runtime-src/install/lib/libur_loader.so* "$PWD/toolchain/lib/" 2>/dev/null || true
123+
cp unified-runtime-src/install/lib/plugins/* "$PWD/toolchain/lib/plugins/" 2>/dev/null || true
124+
cp unified-runtime-src/build/lib/libur_adapter_cuda.so* "$PWD/toolchain/lib/" 2>/dev/null || true
125+
cp unified-runtime-src/build/lib/libur_loader.so* "$PWD/toolchain/lib/" 2>/dev/null || true
126+
cp unified-runtime-src/build/lib/plugins/* "$PWD/toolchain/lib/plugins/" 2>/dev/null || true
127+
# Also ensure the built libs are in LD_LIBRARY_PATH
128+
echo LD_LIBRARY_PATH="$PWD/unified-runtime-src/install/lib:$PWD/unified-runtime-src/build/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV
129+
55130
- name: Deduce E2E CMake options
56131
if: inputs.testing_mode != 'run-only'
57132
id: cmake_opts

0 commit comments

Comments
 (0)