cuda: enable streaming auto cache (implement recommended_working_set_size) - #488
cuda: enable streaming auto cache (implement recommended_working_set_size)#488riccardo-galbani wants to merge 1 commit into
Conversation
|
This worked for me on a 7800 XT but I also needed some stuff from #461 like these flags: It's not exactly fast, ~33 t/s PP, 5-6 on TG out of the gate. I just wanted to see if I could. :) |
|
Tested on NVIDIA GB10 (DGX Spark, Grace Blackwell, 128GB unified
ds4: SSD streaming auto cache budget The initial plan (11008 experts) is then correctly refined at runtime ds4: CUDA streaming expert cache capped from 11008 to 4747 experts With the auto-sized cache, generation reaches 8.4 t/s once the expert So the PR is validated on both memory architectures: discrete VRAM |
|
This PR won't work for multi-gpu systems. |
ds4_backend_supports_streaming_auto_cache()only allowed the SSDstreaming auto cache planner to run under
DS4_BACKEND_METAL, orunder
DS4_BACKEND_CUDAwhen built withDS4_ROCM_BUILD— which aplain
make cuda-generic(nvcc) build never defines. As a result,CUDA users always had to pass
--ssd-streaming-cache-expertsexplicitly, and
ds4_gpu_recommended_working_set_size()inds4_cuda.cu was an unimplemented stub returning 0.
This implements the CUDA working set size using
cudaMemGetInfo'stotal device memory (the closest analogue to Metal's
recommendedMaxWorkingSetSize), and extends the guard so CUDA can use
the same auto cache planner Metal already has.
Tested on a CUDA GPU with 8GB VRAM with DeepSeek V4 Flash (the
project's reference model):
ds4: SSD streaming auto cache budget
ds4: cuda recommends 7.62 GiB working set
ds4: using 80% total for model + cached experts: 6.10 GiB
ds4: non-routed weights: 8.20 GiB
ds4: routed expert size: 6.75 MiB
ds4: cached expert count: 1 (0.01 GiB)