Skip to content

Commit 9abe6f0

Browse files
committed
ci: test prover on CUDA
1 parent 0c3b895 commit 9abe6f0

4 files changed

Lines changed: 48 additions & 22 deletions

File tree

.github/workflows/gpu-tests.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: GPU Tests (merge queue)
22

3-
# Run the CUDA-only test groups (which CPU CI can't, since GitHub runners have no GPU) on a
4-
# rented Vast.ai RTX 5090 when a PR is in the merge queue, and block the merge if they fail.
3+
# Run the GPU test suite (which CPU CI can't, since GitHub runners have no GPU) on a rented
4+
# Vast.ai RTX 5090 when a PR is in the merge queue, and block the merge if it fails.
55
# Groups (see scripts/gpu_test.sh): math-cuda kernel parity, cuda_path_integration (GPU proof
6-
# verifies), cuda_fallback (CPU fallback verifies). Orchestration runs on a GitHub-hosted
7-
# runner; all GPU work happens on the rented box (provisioned by the template onstart). The
8-
# box is ALWAYS destroyed at the end.
6+
# verifies), cuda_fallback (CPU fallback verifies), the prover/stark/crypto/ecsm suite on the
7+
# GPU path, and the comprehensive all-instructions prove. Orchestration runs on a GitHub-hosted
8+
# runner; all GPU work happens on the rented box (provisioned by the template onstart). The box
9+
# is ALWAYS destroyed at the end.
910
#
1011
# Triggered on `merge_group` (one rental per merge, not per push) + `workflow_dispatch` for
1112
# manual runs. To gate merges, add the job name `gpu-tests` to the branch-protection required
@@ -31,8 +32,8 @@ concurrency:
3132
cancel-in-progress: true
3233

3334
env:
34-
# Vast offer search: RTX 5090, >=16 cores, >=32GB RAM (workloads are small), >=64GB disk,
35-
# verified + rentable, Blackwell-capable driver, <= cap.
35+
# Vast offer search: RTX 5090, >=16 cores, >=64GB RAM (the prover suite proves real ELFs,
36+
# so allow headroom), >=64GB disk, verified + rentable, Blackwell-capable driver, <= cap.
3637
GPU_NAME: RTX_5090
3738
PRICE_CAP: "1"
3839
VAST_IMAGE_DISK: "64"
@@ -49,9 +50,9 @@ env:
4950
jobs:
5051
gpu-tests:
5152
runs-on: ubuntu-latest
52-
# Provisioning + dual-feature cuda build (~25 min) + the three test groups (~15 min) +
53-
# image-pull slack. Generous ceiling; teardown still always destroys the box.
54-
timeout-minutes: 120
53+
# Provisioning + cuda builds + 5 test groups; the prover suite (single-threaded, real
54+
# ELF proves) dominates. Generous ceiling; teardown still always destroys the box.
55+
timeout-minutes: 240
5556
steps:
5657
- name: Install Vast CLI
5758
# No secrets in this step's env: install-time code can't read the API key during pip
@@ -89,7 +90,7 @@ jobs:
8990
# 13.1 because the template's nvcc is 13.1 and build.rs JIT-compiles its PTX at load —
9091
# a 13.0 driver rejects 13.1 PTX (CUDA_ERROR_UNSUPPORTED_PTX_VERSION). Bump this in
9192
# lockstep if the base image's CUDA toolkit changes.
92-
QUERY="gpu_name=${GPU_NAME} num_gpus=1 cpu_cores_effective>=16 cpu_ram>=32 disk_space>=64 verified=true rentable=true cuda_max_good>=13.1 dph_total<=${PRICE_CAP}"
93+
QUERY="gpu_name=${GPU_NAME} num_gpus=1 cpu_cores_effective>=16 cpu_ram>=64 disk_space>=64 verified=true rentable=true cuda_max_good>=13.1 dph_total<=${PRICE_CAP}"
9394
echo "Query: $QUERY (+ client-side driver_version major >= $MIN_DRIVER)"
9495
# Keep only offers whose driver major >= MIN_DRIVER, then most expensive first (within
9596
# the cap) — premium hosts have faster disks/network and better reliability; cheapest

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
compile-programs clean-asm clean-rust clean-bench clean-shared clean test test-asm \
33
test-rust test-executor test-flamegraph flamegraph-prover \
44
test-fast test-prover test-prover-all test-disk-spill test-math-cuda test-cuda-integration test-cuda-fallback \
5+
test-prover-cuda test-prover-comprehensive-cuda \
56
bench-math-cuda bench-prover bench-prover-cuda build check clippy fmt lint regen-ethrex-fixtures \
67
update-ethrex-fixture-checksums check-ethrex-fixture-checksums
78

@@ -254,6 +255,20 @@ test-cuda-fallback:
254255
cargo test -p lambda-vm-prover --release --features test-cuda-faults \
255256
--test cuda_fallback_tests -- --ignored --nocapture
256257

258+
# The prover/stark/crypto/ecsm test suite with the GPU (cuda) path enabled (requires NVIDIA
259+
# GPU + nvcc). The GPU CI counterpart of CPU CI's sharded prover tests. Single-threaded: the
260+
# GPU serializes proves and the dispatch counters are process-global. cuda on prover cascades
261+
# to stark; crypto/ecsm build without it (they have no GPU path).
262+
test-prover-cuda:
263+
cargo test --release -p lambda-vm-prover -p stark -p crypto -p ecsm \
264+
--features lambda-vm-prover/cuda -- --test-threads=1
265+
266+
# The comprehensive all-instructions prove (ignored by default) on the GPU path (requires
267+
# NVIDIA GPU + nvcc). GPU counterpart of CPU CI's merge-queue-only comprehensive job.
268+
test-prover-comprehensive-cuda:
269+
cargo test --release -p lambda-vm-prover --features cuda \
270+
test_prove_elfs_all_instructions_64_full -- --ignored --test-threads=1 --nocapture
271+
257272
# math-cuda quick microbench (median of 10 runs)
258273
bench-math-cuda:
259274
cargo test -p math-cuda --release --test bench_quick -- --ignored --nocapture

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ See [`spec/README.md`](./spec/README.md) for full setup instructions.
188188
| `make test-math-cuda` | math-cuda GPU kernel parity tests (requires NVIDIA GPU + nvcc; see GPU Tests) |
189189
| `make test-cuda-integration` | End-to-end GPU dispatch + proof verification (requires NVIDIA GPU + nvcc) |
190190
| `make test-cuda-fallback` | GPU error-path / CPU-fallback tests (requires NVIDIA GPU + nvcc) |
191+
| `make test-prover-cuda` | Prover/stark/crypto/ecsm suite on the GPU path (requires NVIDIA GPU + nvcc) |
192+
| `make test-prover-comprehensive-cuda` | Comprehensive all-instructions prove on the GPU path (requires NVIDIA GPU + nvcc) |
191193
| `make build` | Build all workspace crates |
192194
| `make check` | Check all crates (faster than build, no codegen) |
193195
| `make clippy` | Run clippy on all crates |
@@ -228,6 +230,8 @@ The CUDA test groups run only on a machine with an NVIDIA GPU and `nvcc`:
228230
- `make test-math-cuda` — GPU-vs-CPU kernel parity (NTT, LDE, barycentric, FRI, …)
229231
- `make test-cuda-integration` — proves a guest on GPU and checks every dispatch fired + the proof verifies
230232
- `make test-cuda-fallback` — forces GPU dispatch errors and checks the CPU fallback still verifies
233+
- `make test-prover-cuda` — the prover/stark/crypto/ecsm suite with the GPU path enabled
234+
- `make test-prover-comprehensive-cuda` — the comprehensive all-instructions prove on the GPU path
231235

232236
**Requirement: an NVIDIA driver supporting CUDA ≥ 13.1.** The kernels are compiled with the
233237
toolkit's `nvcc` (currently CUDA 13.1) into PTX that the driver JIT-compiles at load; a driver

scripts/gpu_test.sh

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
#
33
# gpu_test.sh — run the CUDA-only test groups on a GPU box.
44
#
5-
# These groups can't run in CPU CI (GitHub runners have no GPU):
6-
# 1. math-cuda kernel parity (make test-math-cuda)
7-
# 2. end-to-end GPU dispatch + proof (make test-cuda-integration)
8-
# 3. GPU error-path / CPU fallback (make test-cuda-fallback)
5+
# Exercises the CUDA path, which CPU CI can't (GitHub runners have no GPU):
6+
# 1. math-cuda kernel parity (make test-math-cuda)
7+
# 2. end-to-end GPU dispatch + proof (make test-cuda-integration)
8+
# 3. GPU error-path / CPU fallback (make test-cuda-fallback)
9+
# 4. prover/stark/crypto/ecsm suite (make test-prover-cuda) — CPU CI's prover tests on GPU
10+
# 5. comprehensive all-instructions (make test-prover-comprehensive-cuda)
911
#
1012
# Runs on the rented Vast box from the gpu-tests.yml merge-queue workflow. All three groups
1113
# run even if one fails (so the log shows every failure); the script exits non-zero if ANY
@@ -42,12 +44,14 @@ log "pinning cudarc to $CUDARC_PIN"
4244
sed -i "s/\"cuda-version-from-build-system\"/\"${CUDARC_PIN}\"/; /\"fallback-latest\"/d" \
4345
crypto/math-cuda/Cargo.toml
4446

45-
# --- Build the asm guest ELFs used by Groups 2 & 3 (clang on .s; fast) ----------
46-
# (math-cuda parity tests need no ELF; cuda_path_integration / cuda_fallback prove an asm ELF.)
47-
log "compiling asm guest programs"
47+
# --- Build the guest ELFs the tests prove ---------------------------------------
48+
# math-cuda parity needs none; cuda_path_integration / cuda_fallback prove an asm ELF; the
49+
# prover suite (Groups 4 & 5) proves asm AND rust guests. Build both up front.
50+
log "compiling guest programs (asm + rust)"
4851
make compile-programs-asm
52+
make compile-programs-rust
4953

50-
# --- Run the three CUDA test groups via the Makefile targets --------------------
54+
# --- Run the CUDA test groups via the Makefile targets --------------------------
5155
fail=0
5256
run() { # $1 = make target
5357
log "make $1"
@@ -56,9 +60,11 @@ run() { # $1 = make target
5660
fail=1
5761
fi
5862
}
59-
run test-math-cuda # Group 1: kernel parity
60-
run test-cuda-integration # Group 2: end-to-end GPU dispatch + proof verifies
61-
run test-cuda-fallback # Group 3: GPU error -> CPU fallback still verifies
63+
run test-math-cuda # Group 1: kernel parity
64+
run test-cuda-integration # Group 2: end-to-end GPU dispatch + proof verifies
65+
run test-cuda-fallback # Group 3: GPU error -> CPU fallback still verifies
66+
run test-prover-cuda # Group 4: prover/stark/crypto/ecsm suite on the GPU path
67+
run test-prover-comprehensive-cuda # Group 5: comprehensive all-instructions prove on GPU
6268

6369
if [ "$fail" -ne 0 ]; then
6470
log "FAILED — one or more GPU test groups failed"

0 commit comments

Comments
 (0)