Skip to content

fix(cuda): include <float.h> for FLT_MAX (build fails on CUDA 12.8 / Blackwell) - #666

Closed
joelteply wants to merge 1 commit into
antirez:mainfrom
joelteply:fix/cuda-12.8-flt-max
Closed

fix(cuda): include <float.h> for FLT_MAX (build fails on CUDA 12.8 / Blackwell)#666
joelteply wants to merge 1 commit into
antirez:mainfrom
joelteply:fix/cuda-12.8-flt-max

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Problem

Building the CUDA backend with a recent nvcc (tested: CUDA 12.8, nvidia/cuda:12.8.0-devel-ubuntu24.04, RTX 5090 / sm_120) fails:

ds4_cuda.cu(23467): error: identifier "FLT_MAX" is undefined
ds4_cuda.cu(23821): error: identifier "FLT_MAX" is undefined
ds4_cuda.cu(24024): error: identifier "FLT_MAX" is undefined

ds4_cuda.cu uses FLT_MAX but only includes <math.h> and <limits.h>. FLT_MAX lives in <float.h>, which older CUDA toolchains happened to pull in transitively but 12.8 does not.

Fix

Add the explicit #include <float.h>. One line, no behavior change; still builds on toolchains that had it transitively.

Repro

docker run --rm --gpus all -v $PWD:/ds4 nvidia/cuda:12.8.0-devel-ubuntu24.04 \
  bash -c "apt-get update && apt-get install -y build-essential && cd /ds4 && make cuda CUDA_ARCH=sm_120"

Fails before this change, builds clean after (all of ds4/ds4-server/ds4-bench/ds4-eval/ds4-agent).


Minor related note for anyone building in a GPU-less environment (CI, docker build): make cuda-generic sets CUDA_ARCH=native, which needs a GPU present to detect — off-GPU it falls back to a default arch and later fails on __dp4a etc. Use make cuda CUDA_ARCH=sm_120 (explicit) there. Happy to send a small containerized-build Dockerfile as a follow-up if useful.

Thanks for ds4 — the SSD-streaming expert cache is excellent work.

…ackwell)

ds4_cuda.cu uses FLT_MAX (e.g. lines 23467, 23821, 24024) but only
includes <math.h> and <limits.h>. On CUDA 12.8's nvcc (Blackwell / sm_120
toolchain) <float.h> is not pulled in transitively, so the CUDA build
fails:

  ds4_cuda.cu(23467): error: identifier "FLT_MAX" is undefined

Add the explicit <float.h> include. No behavior change; builds clean on
older toolchains that already had it transitively.
@antirez antirez closed this in 727836a Aug 4, 2026
fulvius31 pushed a commit to fulvius31/ds4 that referenced this pull request Aug 4, 2026
Make the CUDA source independent of indirect standard-library includes in newer NVCC releases.

Closes antirez#666

Closes antirez#667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant