forked from ml-explore/mlx
-
Notifications
You must be signed in to change notification settings - Fork 0
98 lines (93 loc) · 2.66 KB
/
gpu-test.yml
File metadata and controls
98 lines (93 loc) · 2.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: GPU Kernel Tests
on:
push:
branches: [main, master]
pull_request:
jobs:
metal-test:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Compile Metal shaders
run: |
cd kernels
PASS=0; FAIL=0
for f in *.metal; do
if xcrun -sdk macosx metal -std=metal3.0 -Werror -c "$f" -o /dev/null 2>/dev/null; then
PASS=$((PASS+1))
else
echo "FAIL: $f"
FAIL=$((FAIL+1))
fi
done
echo "$PASS Metal shaders pass, $FAIL fail"
[ $FAIL -eq 0 ] || exit 1
wgsl-validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install naga
run: cargo install naga-cli
- name: Validate WGSL shaders
run: |
cd kernels
PASS=0; FAIL=0
for f in *.wgsl; do
if naga "$f" 2>/dev/null; then
PASS=$((PASS+1))
else
echo "FAIL: $f"
FAIL=$((FAIL+1))
fi
done
echo "$PASS WGSL shaders pass, $FAIL fail"
[ $FAIL -eq 0 ] || exit 1
cuda-compile:
runs-on: ubuntu-latest
container: nvidia/cuda:12.4.0-devel-ubuntu22.04
steps:
- uses: actions/checkout@v4
- name: Compile CUDA kernels
run: |
cd kernels
PASS=0; FAIL=0
for f in *.cu; do
if nvcc -std=c++17 --compile "$f" -o /dev/null 2>&1; then
PASS=$((PASS+1))
else
echo "FAIL: $f"
FAIL=$((FAIL+1))
fi
done
echo "$PASS CUDA kernels compile, $FAIL fail"
[ $FAIL -eq 0 ] || exit 1
cuda-benchmark:
runs-on: [self-hosted, gpu, cuda]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: cuda-compile
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Build GPU library
run: |
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release -DLUX_GPU_CUDA_BACKEND=ON
cmake --build . --parallel
- name: Run CUDA benchmarks
run: |
cd build
./test/test_backends 2>&1
echo "=== Benchmark complete ==="
cuda-cpu-mode:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Compile CUDA kernels as C++ (CPU mode)
run: |
g++ -std=c++17 -O2 -I kernels -o test_cuda_cpu test/test_cuda_cpu.cpp
- name: Run CUDA CPU-mode tests
run: ./test_cuda_cpu