hybrid-storage: constrain cold experts to large-memory GPUs - #9
Draft
marcelormendes wants to merge 1 commit into
Draft
hybrid-storage: constrain cold experts to large-memory GPUs#9marcelormendes wants to merge 1 commit into
marcelormendes wants to merge 1 commit into
Conversation
DeepSeek V4 Flash dual-GPU init (Halo 780M UMA + RX 7900 XT dGPU) failed when ~80 GiB cold expert tensors landed on the 20 GiB 7900: ggml_backend_cuda_buffer_type_alloc_buffer: allocating 1904.00 MiB on device 1: cudaMalloc failed: out of memory Hybrid storage now checks device total memory before using a GPU for cold experts. Devices <=24 GiB fall back to CPU, preventing OOM on small dGPUs while allowing UMA and high-capacity accelerators. Threshold: 25 GiB excludes RX 7900 XT (~20 GiB), RTX 4090 (24 GiB); allows Halo 780M UMA (122 GiB), datacenter GPUs. Fixes dual-HIP same-backend split init without breaking Halo-only path. Co-authored-by: Marcelo Ribeiro Mendes <mmendes200@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
DeepSeek V4 Flash ROCmFP2 (~95.3 GiB) on soulf: Halo gfx1151 (122880 MiB UMA) + RX 7900 XT gfx1100 (~20464 MiB). Latest main cfa76af.
HIP_VISIBLE_DEVICES=1): listens and generates ✅HIP_VISIBLE_DEVICES=1,0; hip:0=Halo, hip:1=7900, peer enabled): dies during DeepSeek4Backend init ❌Placement log before fail: hybrid, gpu_free~114.62 GiB, expert_budget=11.43 GiB (DFLASH_EXPERT_BUDGET_MB=11700), hot=11.42 GiB, cold=79.95 GiB. The 1904 MiB cold buffer landed on ROCm device 1 (the 7900) which already had ~11.4 GiB hot experts.
Root cause: Hybrid expert storage assigned cold expert GPU buffer to device 1 because it iterated ROCm backends and the 7900 still had a few GiB free. Cold expert tensors (~80 GiB) must not be allocated on a ~20 GiB dGPU.
Solution
Smallest useful change: Check device total memory before using a GPU for cold experts. Devices ≤24 GiB fall back to CPU.
Added
gpu_backend_suitable_for_cold_experts()helper:ggml_backend_dev_memory()for device total memoryApplied in both
build_moe_hybrid_storage()andbuild_moe_hybrid_storage_from_file(): whencfg.cold_expert_backend == MoeHybridColdBackend::Gpu, check the candidate backend before assignment. If unsuitable, fall back to CPU with a clear warning.Result
Testing
Threshold choice (25 GiB) intentionally conservative: excludes all consumer dGPUs ≤24 GiB, allows professional/UMA devices.
Poteto-mode: subtract before add ✅ (no new subsystem), smallest useful change ✅, prove the claim ✅ (guards against <=24 GiB devices).