You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(math-cuda): driver-independent cuda builds (cudarc pin + cubin AOT) (#800)
* fix(math-cuda): robust CUDA version handling for cuda builds
Two driver-independence fixes so `--features cuda` builds AND runs on the
team's GPU hardware without CUDARC_CUDA_VERSION env or a hand-picked toolkit.
1. cudarc symbol floor. Pin cudarc's CUDA version to `cuda-12080` in
crypto/math-cuda/Cargo.toml (was `cuda-version-from-build-system` +
`fallback-latest`). Auto-detect bound the newest symbol set the build
toolkit knew (e.g. CUDA 13.1 -> cuDevSmResourceSplit, gated behind
cuda-13010/13020), which cudarc eagerly resolves at init and panics on a
driver that predates it (580.x = CUDA 13.0 max). Our cudarc surface is all
CUDA-11-era, so the 12.8 symbol set (a strict subset every >=12.8 driver
exports) resolves cleanly everywhere. Replaces the per-script sed pin;
drops it from scripts/gpu_test.sh and adjusts the compat shim in
scripts/bench_abba.sh (still rewrites pre-pin baseline shas).
2. PTX ISA version. AOT-compile kernels to native cubin (SASS) via
`nvcc --cubin -arch=sm_XX` instead of `--ptx`, loaded through
`Ptx::from_binary` (cuModuleLoadData). A cubin carries pre-compiled SASS
for a real arch, so the driver loads it regardless of the toolkit's PTX
ISA version -- no CUDA_ERROR_UNSUPPORTED_PTX_VERSION and no silent
CPU fallback when the toolkit is newer than the driver. Build+run are
co-located and the arch is detected from nvidia-smi, so the arch always
matches; a too-old toolkit now fails loudly at nvcc build time.
CPU-only and nvcc-less stub builds unaffected (empty cubin stub). README
"GPU Tests" updated.
* fix(math-cuda): review fixes — warn on cubin load failure + bench pin no-op
- backend(): warn once when GPU init fails, so a cubin arch mismatch (AOT cubins
are arch-specific) doesn't silently disable the GPU with no signal. Stale
ptx->cubin comment fixed.
- bench_abba.sh: warn when CUDARC_PIN can't apply (post-pin sha, anchor gone)
instead of silently no-opping.
* fix(math-cuda,scripts): review fixes — warn on sm_89 arch fallback + bench_abba_gpu pin guard/restore + cubin comment
* refactor(scripts): shared ABBA bench lib + README GPU driver floor
bench_abba.sh and bench_abba_gpu.sh carried near-verbatim copies of the
prove-time parsing, the CUDARC_PIN compat sed, and the paired-stats python —
a stats fix applied to one would silently leave the other reporting different
numbers for the same pairs. scripts/lib/bench_abba_common.sh now holds all
three; the GPU bench gains the full analysis (exact Wilcoxon, stability
diagnostics, verdicts) it previously lacked.
README: state the cuda-12080 pin's driver floor (CUDA >= 12.8 / 570+) and
that older drivers abort at CUDA init rather than CPU-fallback.
* chore(scripts): drop unused bench_abba_gpu.sh
No automation calls it (the GPU bench CI runs bench_abba.sh), and its whole
premise — the rigorous ABBA paired-t + Wilcoxon method — is overkill for the
question it wrapped: a GPU-on-vs-off delta is 10-40%, which two runs and your
eyes resolve. The ABBA machinery earns its keep only for the ~1% effects
(bench_abba.sh's PR-vs-baseline deltas), so one bench script is enough.
* fix(math-cuda): hard-fail arch detection instead of guessing sm_89
A cubin is arch-locked, so when nvcc is present but no GPU arch can be
detected there is no safe default — the old sm_89 fallback produced a binary
that loads on exactly one GPU model (Ada) and silently CPU-falls-back on every
other, including lower-arch cards like the 3090 (sm_86, which an sm_89 cubin
can't even run — cubins aren't backward-compatible). Panic with an actionable
message (set CUDARC_NVCC_ARCH or build on the target host) instead. Only
reachable with nvcc present + no visible GPU + no override; nvcc-absent hosts
take the empty-stub path and never hit this, so CPU-only CI is unaffected.
* chore(scripts): move ABBA bench cleanup to its own PR (#812)
The bench-tooling dedup + bench_abba_gpu.sh removal are split into #812 so this
PR is purely the cuda build-robustness changes (which want a GPU test run),
leaving the trivial script cleanup free to merge independently.
0 commit comments