Files
Strata/include/strata/core/window_evict.hpp
T
Niko1221 a8c1d4b7f8 verify: a window graph that does not fit frees the graphs of other window sizes instead of ending the engine (#3702)
On a layer split the later card is left with a few dozen MiB after loading, and each single-request window size is
captured the first time it is used (68, 64, 58, 52 and then 10 MiB free in the report); when one capture's
cudaGraphInstantiate ran out of memory, instantiate_evicting could only free graphs of batch slot layouts, a
single-request run has none, and "verify: instantiate: out of memory" ended the engine.

Now, after the batch layouts, a single-request window's capture frees the graph of the largest other window size (never the
one being captured or a prelaunched one; pick_window_victim) and instantiates again, and says so once: the freed size is
captured again when it is next used. capture_all keeps every size at once and is excluded. Only a failed instantiate does
anything new; with enough VRAM nothing changes.

window_evict_test (CPU, header-only) covers the choice. The real gate needs a model on a 2-GPU split with a thin later card
(listed in the triage file); not changed here: the later-stage reserve of the split search (kWindowMib), which is a default
placement change.
2026-10-26 18:51:29 +01:00

20 lines
866 B
C++

#pragma once
// Which single-request window graph to free when the next one cannot be instantiated for lack of VRAM (#3702).
// Header-only so a CPU test can run it (src/core/window_evict_test.cpp).
namespace strata::core {
/// The size T (1..max_t) whose captured graph is freed first: the largest size other than `keep` (the one being
/// captured) and `pinned` (a window of that size was prelaunched and must stay), among those with a graph (`have[t]`).
/// The larger sizes cost the most VRAM and are asked for least often, and a freed size is captured again when it is
/// next needed. 0: nothing to free.
inline int pick_window_victim(const bool* have, int max_t, int keep, int pinned) {
for (int t = max_t; t >= 1; --t) {
if (t == keep || t == pinned || !have[t]) continue;
return t;
}
return 0;
}
} // namespace strata::core