Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ds4.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,9 @@ static bool ds4_backend_supports_ssd_streaming(ds4_backend backend) {

static bool ds4_backend_supports_streaming_auto_cache(ds4_backend backend) {
if (backend == DS4_BACKEND_METAL) return true;
#ifdef DS4_ROCM_BUILD
/* CUDA now has a working ds4_gpu_recommended_working_set_size()
* implementation, so the auto cache planner can run here too. */
if (backend == DS4_BACKEND_CUDA) return true;
#else
(void)backend;
#endif
return false;
}

Expand Down
14 changes: 13 additions & 1 deletion ds4_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -2781,7 +2781,19 @@ extern "C" void ds4_gpu_set_streaming_expert_cache_expert_bytes(uint64_t bytes)
}

extern "C" uint64_t ds4_gpu_recommended_working_set_size(void) {
return 0;
/* Metal exposes recommendedMaxWorkingSetSize natively; CUDA has no
* direct equivalent, so use total device memory as the closest
* analogue. The 80% margin applied by callers (see
* ds4_ssd_auto_cache_plan) accounts for KV cache, activations and
* driver overhead. */
size_t free_bytes = 0, total_bytes = 0;
cudaError_t err = cudaMemGetInfo(&free_bytes, &total_bytes);
(void)free_bytes;
if (err != cudaSuccess) {
(void)cudaGetLastError();
return 0;
}
return (uint64_t)total_bytes;
}

extern "C" uint32_t ds4_gpu_stream_expert_cache_configured_count(void) {
Expand Down