Skip to content

Commit c380567

Browse files
fix(ci): rust cache needs to be cuda architecture specific (#2287)
CUDA workflows use rust cache but stark-backend's rust cache contains cuda architecture specific machine code. We make a composite github action that wraps Swatinem/rust-cache and adds the cuda arch as a cache key.
1 parent 5de5b22 commit c380567

File tree

6 files changed

+40
-5
lines changed

6 files changed

+40
-5
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "Rust Cache with CUDA Architecture"
2+
description: "Wraps Swatinem/rust-cache with GPU architecture in cache key to avoid CUDA library conflicts"
3+
4+
inputs:
5+
cache-on-failure:
6+
description: "Cache even if the build fails"
7+
required: false
8+
default: "true"
9+
key:
10+
description: "Additional cache key suffix"
11+
required: false
12+
default: ""
13+
14+
runs:
15+
using: "composite"
16+
steps:
17+
- name: Detect GPU architecture
18+
id: gpu-arch
19+
shell: bash
20+
run: |
21+
if command -v nvidia-smi &> /dev/null; then
22+
# Get compute capability (e.g., "8.9" -> "89")
23+
CUDA_ARCH=$(nvidia-smi --query-gpu=compute_cap --format=csv,noheader 2>/dev/null | head -1 | tr -d '.' || echo "unknown")
24+
echo "cuda_arch=$CUDA_ARCH" >> $GITHUB_OUTPUT
25+
echo "Detected CUDA architecture: $CUDA_ARCH"
26+
else
27+
echo "cuda_arch=no-gpu" >> $GITHUB_OUTPUT
28+
echo "No GPU detected"
29+
fi
30+
31+
- name: Rust cache
32+
uses: Swatinem/rust-cache@v2
33+
with:
34+
cache-on-failure: ${{ inputs.cache-on-failure }}
35+
key: ${{ inputs.key }}${{ inputs.key && '-' || '' }}cuda-${{ steps.gpu-arch.outputs.cuda_arch }}

.github/workflows/base-tests.cuda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
rustup component remove clippy || true
3737
rm -rf ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu || true
3838
- uses: dtolnay/rust-toolchain@stable
39-
- uses: Swatinem/rust-cache@v2
39+
- uses: ./.github/actions/rust-cache-cuda
4040
with:
4141
cache-on-failure: true
4242
- uses: taiki-e/install-action@nextest

.github/workflows/benchmark-call.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ jobs:
142142
rustup component remove clippy || true
143143
rm -rf ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu || true
144144
- uses: dtolnay/rust-toolchain@stable
145-
- uses: Swatinem/rust-cache@v2
145+
- uses: ./.github/actions/rust-cache-cuda
146146
with:
147147
cache-on-failure: true
148148

.github/workflows/extension-tests.cuda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
rustup component remove clippy || true
9090
rm -rf ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu || true
9191
- uses: dtolnay/rust-toolchain@stable
92-
- uses: Swatinem/rust-cache@v2
92+
- uses: ./.github/actions/rust-cache-cuda
9393
with:
9494
cache-on-failure: true
9595
- uses: taiki-e/install-action@nextest

.github/workflows/guest-lib-tests.cuda.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
rustup component remove clippy || true
108108
rm -rf ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu || true
109109
- uses: dtolnay/rust-toolchain@stable
110-
- uses: Swatinem/rust-cache@v2
110+
- uses: ./.github/actions/rust-cache-cuda
111111
with:
112112
cache-on-failure: true
113113
- uses: taiki-e/install-action@nextest

.github/workflows/lints.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
rustup component remove clippy || true
8787
rm -rf ~/.rustup/toolchains/stable-x86_64-unknown-linux-gnu || true
8888
- uses: dtolnay/rust-toolchain@stable
89-
- uses: Swatinem/rust-cache@v2
89+
- uses: ./.github/actions/rust-cache-cuda
9090
with:
9191
cache-on-failure: true
9292
- name: Verify CUDA setup

0 commit comments

Comments
 (0)