Parking a conversation beats the watchdog: its checkpoint and K/V copies report progress, the stage is named, Windows counts hard page faults as file-tier activity, and the stall report and each request say how little VRAM is free (#2049 #2065)
This commit is contained in:
1 parent
798f3006bb
commit
3804b43f19
4 files changed
+97
-13
No files matched your search
@@ -1156,12 +1156,14 @@ static uint64_t file_tier_activity() {
|
||||
return total;
|
||||
#elif defined(_WIN32)
|
||||
// #1984 #1971: Windows had no measure here, so a prompt waiting on mapped-file page-ins never got the I/O allowance.
|
||||
// Bytes read (MiB) plus page faults / 64 (Windows counts soft faults too; a stuck engine makes almost none).
|
||||
// Bytes read (MiB) plus page faults / 8 (Windows counts soft faults too; a stuck engine makes almost none).
|
||||
uint64_t total = 0;
|
||||
IO_COUNTERS io{};
|
||||
if (GetProcessIoCounters(GetCurrentProcess(), &io)) total += io.ReadTransferCount >> 20;
|
||||
PROCESS_MEMORY_COUNTERS pmc{};
|
||||
if (K32GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof pmc)) total += pmc.PageFaultCount >> 6;
|
||||
// >> 3, not >> 6: a host that pages hard reads from the pagefile at ~200 faults a second (#2049: 190/s, one
|
||||
// thread waiting on one page at a time), which at >> 6 is 3 a second and never counted as busy
|
||||
if (K32GetProcessMemoryInfo(GetCurrentProcess(), &pmc, sizeof pmc)) total += pmc.PageFaultCount >> 3;
|
||||
return total;
|
||||
#else
|
||||
return 0;
|
||||
@@ -1261,12 +1263,29 @@ bool launch_blocking() {
|
||||
#endif
|
||||
}
|
||||
|
||||
/// #2065: the VRAM free when the current request began (-1 before the first); the stall report prints it, because a
|
||||
/// card this full is the one measured cause of a window that never finishes (the driver pages GPU memory).
|
||||
std::atomic<int64_t> g_req_vram_free_mib{-1};
|
||||
constexpr int64_t kVramSafeMib =
|
||||
#ifdef _WIN32
|
||||
1024; // WDDM pages instead of failing (docs/DETAILS.md, the sysmem fallback): the line #2065 fell below
|
||||
#else
|
||||
512;
|
||||
#endif
|
||||
|
||||
void stall_report(std::FILE* f, uint64_t layers_during) {
|
||||
strata::core::Progress& p = strata::core::progress();
|
||||
std::fprintf(f, "strata serve: stall report (engine %s): stage \"%s\" for %lld s; %llu layers served since the "
|
||||
"last finished step (0 = stopped, more = slow)\n", STRATA_VERSION, stage_text().c_str(),
|
||||
(long long) ((strata::core::progress_now_ms() - p.since_ms.load()) / 1000),
|
||||
(unsigned long long) layers_during);
|
||||
if (const int64_t vf = g_req_vram_free_mib.load(); vf >= 0) {
|
||||
std::fprintf(f, " VRAM free when this request began: %lld MiB%s\n", (long long) vf,
|
||||
vf >= kVramSafeMib ? "" : " - LOW: a card this full can page GPU memory to system RAM (decode "
|
||||
"falls to a few tok/s, then a window never finishes, #2065); a larger --vram-reserve-mib, a "
|
||||
"smaller --max-context, or 'Prefer No Sysmem Fallback' for the engine in the NVIDIA control panel "
|
||||
"(docs/DETAILS.md) leaves room");
|
||||
}
|
||||
for (int pass = 0; pass < 2; ++pass) {
|
||||
if (pass == 1) {
|
||||
std::this_thread::sleep_for(std::chrono::seconds(2));
|
||||
@@ -7844,6 +7863,14 @@ int main(int argc, char** argv) {
|
||||
// addresses change: all parked images live in ordinary host vectors.
|
||||
auto park_current_body = [&](size_t held) -> bool {
|
||||
if (!conversations.enabled() || !live_ok || live.empty()) return true;
|
||||
// #2049: parking copies the outgoing conversation's running checkpoints and K/V into host memory, which
|
||||
// is a silent stretch of the "request" stage; when the OS has paged that memory out it takes minutes.
|
||||
// Named, so a stall report says "parking"; its copies beat (conversation_copy.hpp), so the watchdog
|
||||
// sees a park that moves and ends one that does not.
|
||||
struct ParkStage {
|
||||
ParkStage() { strata::core::progress_at("request: parking the previous conversation"); }
|
||||
~ParkStage() { strata::core::progress_at("request"); strata::core::progress_beat(); }
|
||||
} park_stage;
|
||||
// --conversation-cache-min-tokens: a short conversation is not worth one of the slots. Parking is a
|
||||
// switch-time decision, so a client's small side requests would otherwise park themselves and, once the
|
||||
// cache is full, evict the long conversation they were interleaved with (oldest first) - the reuse it
|
||||
@@ -9819,6 +9846,24 @@ int main(int argc, char** argv) {
|
||||
strata::core::progress_at("idle");
|
||||
}
|
||||
} busy_scope;
|
||||
{ // #2065: said, never changed - the free VRAM now (the verify windows' captures and the batch layouts
|
||||
// eat into what startup reported), once per 128 MiB lower it gets
|
||||
size_t vf_b = 0, vt_b = 0;
|
||||
if (cudaMemGetInfo(&vf_b, &vt_b) == cudaSuccess) {
|
||||
const int64_t vf = (int64_t) (vf_b >> 20);
|
||||
g_req_vram_free_mib.store(vf);
|
||||
static int64_t low_said_at = INT64_MAX;
|
||||
if (vf < kVramSafeMib && vf + 128 <= low_said_at) {
|
||||
low_said_at = vf;
|
||||
std::fprintf(stderr, "strata serve: WARNING: only %lld MiB of VRAM free at the start of this request "
|
||||
"(below %lld MiB): when the card is this full the driver can page GPU memory "
|
||||
"to system RAM, decode falls to a few tok/s and a window may never finish "
|
||||
"(#2065). Add --vram-reserve-mib %lld to the config's args, or lower "
|
||||
"--max-context / --batch\n", (long long) vf, (long long) kVramSafeMib,
|
||||
(long long) ((o.vram_reserve_mib + (kVramSafeMib - vf) + 63) / 64 * 64));
|
||||
}
|
||||
}
|
||||
}
|
||||
stop_req.store(false); // a STOP that arrived between requests is stale
|
||||
err.clear();
|
||||
// Disk sessions: SAVE <path> | RESTORE <path>, between requests (the path runs to the end of the line,
|
||||
|
||||
Reference in new issue
Block a user