From b5217c8bb7423e0e40f95af05777a554ca750894 Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Tue, 13 Oct 2026 02:23:22 +0200 Subject: [PATCH] serve: the VRAM-free check at start covers a layer split's later cards too (#2192) The 'MiB of VRAM free with everything loaded' line and its LOW warning read CUDA0 alone. In #2192 (2x RTX 2080 Ti 22 GB, Windows, IQ3_S, --batch 4, --layer-split auto, 0.1.43) CUDA0 had 740 MiB free while CUDA1 began its window captures at 153 MiB and fell to 52; the first batch window then never finished. Both stall dumps show the host thread inside cudaGraphLaunch called from Verifier::run_slot_rows (the stage still 'idle': it had not reached its per-layer wait), the pool asleep and the watchdog firing after 60 s - a page-in under WDDM while the other card's graph spins on a host flag. Each later card now gets its own line, and below 512 MiB a LOW warning with the --vram-reserve-later-mib value that leaves ~768 MiB. Said, never changed. --- src/program/generate.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/program/generate.cpp b/src/program/generate.cpp index adf97122..6b31bfb0 100644 --- a/src/program/generate.cpp +++ b/src/program/generate.cpp @@ -9174,6 +9174,31 @@ int main(int argc, char** argv) { "slots are written - leaves room; decode can be several times slower with the " "card this full\n", (long long) xcache.slots()); } + // #2192: the same check on a layer split's later cards. The line above reads CUDA0 alone: on 2x RTX 2080 Ti + // (WDDM, --batch 4) CUDA0 had 740 MiB free while CUDA1 started its window captures at 153 MiB and fell to + // 52, and the first batch window on it never finished (the host stuck in cudaGraphLaunch: a page-in while the + // other card's graph spins on a host flag). Said, never changed. + for (const auto& stp : stages) { + const strata::core::OnDevice on(stp->dev); + size_t sf = 0, stot = 0; + if (cudaMemGetInfo(&sf, &stot) != cudaSuccess) { (void) cudaGetLastError(); continue; } + const int64_t sf_mib = (int64_t) (sf >> 20); + const int later_reserve = o.vram_reserve_later_mib >= 0 ? o.vram_reserve_later_mib : o.vram_reserve_mib; + if (sf_mib >= 512) + std::fprintf(stderr, "strata serve: CUDA%d: %lld MiB of VRAM free with everything loaded\n", stp->dev, + (long long) sf_mib); + else + std::fprintf(stderr, "strata serve: CUDA%d: %lld MiB of VRAM free with everything loaded - LOW: its window " + "graphs are captured on first use and need room too, and %s; add " + "--vram-reserve-later-mib %lld to the config's args (or lower --max-context)\n", + stp->dev, (long long) sf_mib, +#ifdef _WIN32 + "under WDDM a full card pages instead of failing, which can stall a request for good (#2192)", +#else + "a full card can stall a request", +#endif + (long long) (later_reserve + 768 - sf_mib)); + } } // what the server's Monitor tab shows (servers before 0.1.8 skip unknown lines until READY) {