From 678076f33652f5f0f01fa3993c4f2cb5d9f44497 Mon Sep 17 00:00:00 2001 From: Gautam <13942232+GautamtmD@users.noreply.github.com> Date: Tue, 24 Nov 2026 12:49:47 +0530 Subject: [PATCH] fix(inkling cuda): refuse a layer split whose later GPU would need host-RAM experts Host-RAM (hybrid) experts only run on the first stage. When a later stage's experts did not fit its VRAM (an explicit --layer-split, a --vram-experts-gb cap, or a busy card), they were assigned to host RAM anyway and launch_ink_moe skipped them: the engine ran and produced wrong output with no error. Fail at load with a message that says what to change instead. Co-Authored-By: Claude Opus 5.5 --- engine/src/inkling2/cuda/ink_runner.cuh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/engine/src/inkling2/cuda/ink_runner.cuh b/engine/src/inkling2/cuda/ink_runner.cuh index 18a38bd0085..08ebb36fbfa 100644 --- a/engine/src/inkling2/cuda/ink_runner.cuh +++ b/engine/src/inkling2/cuda/ink_runner.cuh @@ -1209,6 +1209,14 @@ struct InkCudaModel { stage_n_experts[s]++; if (s == 0) ++n_vram_experts; else ++n_peer_experts; } else { + if (s > 0) { + // Host-RAM (hybrid) experts only run on stage 0: on a later stage they would be skipped + // silently by launch_ink_moe (tier > 1) and the output would be wrong. Refuse instead. + err = "Layer-Split: the experts of GPU " + std::to_string(stage_gpu[s]) + + " do not fit in its VRAM (host-RAM experts only run on the first GPU); give it fewer layers " + "(--layer-split), use --layer-split auto, or free VRAM"; + return false; + } // Preserve lossless native FMT_GGUF_RAW blocks in host RAM (zero SF4 quality loss & zero repack startup delay!) const size_t hb = (eff_bytes[di] + 63ull) & ~63ull; target_tier[di] = 2; uh += hb; ++n_host_experts;