WSL2: survive the driver's ~1 GiB pinned host budget with 3 GPUs
Under WSL2 the NVIDIA driver can pin/map only about 1 GiB of host memory in total (dmesg: "dxgk: create_existing_sysmem: establish_gpadl failed: -122"). With --expert-cache-device1/2 the startup ran out of it twice: - CUDA2's context is created after CUDA0's weights and MTP, whose mapped host buffers have spent the budget: "CUDA2 experts: cudaSetDevice(2) failed: out of memory". STRATA_EARLY_REMOTE_CONTEXTS=1 now creates every secondary context up front, like CUDA1's (opt-in: the default order is unchanged). - With three contexts up, the 260 MiB mapped native embedding no longer fits: "native embedding: cannot pin 260 MiB". It now falls back to a device copy on the current GPU instead of failing the start. Measured in Docker Desktop (WSL2), RTX 5070 Ti + 2x RTX 5060 Ti, Swift 1.5 IQ3_XXS: starts and serves with both helper caches (5000 experts each).
This commit is contained in:
1 parent
e258e6ec5b
commit
1564404f62
2 files changed
+34
-13
No files matched your search
@@ -1331,16 +1331,21 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
}
|
||||
const bool native_pack = strata::kernels::cpu::expert_layout().native;
|
||||
if (o.expert_cache_remote[0] > 0) {
|
||||
// STRATA_EARLY_REMOTE_CONTEXTS=1: create EVERY secondary context here, like CUDA1's. Under WSL2 the driver's
|
||||
// pinned/mapped host budget (dxg gpadl, ~1 GiB) is spent by CUDA0's weights and MTP before the later loop runs,
|
||||
// and a new context then fails with cudaErrorMemoryAllocation (CUDA2: "cudaSetDevice(2) failed: out of memory").
|
||||
const char* early_env = std::getenv("STRATA_EARLY_REMOTE_CONTEXTS");
|
||||
const bool early_remote = early_env && early_env[0] == '1';
|
||||
for (int r = 0; r < 3; ++r) if (o.expert_cache_remote[(size_t) r] > 0 && (r == 0 || early_remote)) {
|
||||
// Keep CUDA1's proven startup order: initialise its context before
|
||||
// allocating GPU0 weights or mapping the large host expert arena.
|
||||
double free_gib = 0;
|
||||
if (!strata::core::RemoteExperts::preflight(remote_dev[0], free_gib, err)) {
|
||||
if (!strata::core::RemoteExperts::preflight(remote_dev[r], free_gib, err)) {
|
||||
std::fprintf(stderr, "strata generate: %s\n", err.c_str());
|
||||
return 1;
|
||||
}
|
||||
std::fprintf(stderr, "strata generate: CUDA%d context ready, %.2f GiB free before expert arena registration\n",
|
||||
remote_dev[0], free_gib);
|
||||
remote_dev[r], free_gib);
|
||||
}
|
||||
// plan v0.3 P6: the PCIe share of the missed experts, measured per kind of pack (the paper, finding on PCIe).
|
||||
// PR #44: a x8 link carries half of what the native default assumes - the GPU's SMs read that share over the
|
||||
@@ -1743,7 +1748,7 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
// Create the additional contexts after MTP has secured CUDA0 memory, but
|
||||
// before the host arena maps its expert pages into their address spaces.
|
||||
for (int r = 1; r < 3; ++r) if (o.expert_cache_remote[(size_t) r] > 0) {
|
||||
for (int r = 1; r < 3; ++r) if (o.expert_cache_remote[(size_t) r] > 0 && !early_remote) {
|
||||
double free_gib = 0;
|
||||
if (!strata::core::RemoteExperts::preflight(remote_dev[r], free_gib, err)) {
|
||||
std::fprintf(stderr, "strata generate: %s\n", err.c_str());
|
||||
|
||||
Reference in new issue
Block a user