mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 23:08:36 +00:00
ling32: the allocation margin (make_room) defaults to 0 = off, the old behaviour; the Windows planner headroom is the fix
L32-SMALL's Linux gate (RTX 5070, tier B, chunk 2048): margin 256 cost 1-3 % of prefill (16K 1199 against 1240 tok/s, 4K 945 against 958) and decode 39.5 against 40.3, and the check never fired on the owner's Windows card (the over-commit is at load, not at an allocation). STRATA_L32_ALLOC_MARGIN_MB keeps the guard as an opt-in; STRATA_L32_REGROW_TRACE=1 still prints the checks. Register note regenerated.
This commit is contained in:
1 parent
037779a020
commit
c966eccc17
2 files changed
+13
-12
No files matched your search
@@ -483,13 +483,14 @@ struct Ling32Engine::StageCtx {
|
||||
if (E.provider_) E.provider_->grow_bytes(~static_cast<size_t>(0));
|
||||
}
|
||||
|
||||
// lazy KV / scratch regrow: before an allocation, make room in the pool if the card has less than BYTES + a margin free (STRATA_L32_ALLOC_MARGIN_MB, default 256 MiB): the store releases whole chunks of pool
|
||||
// lazy KV / scratch regrow: before an allocation, make room in the pool if the card has less than BYTES + a margin free (STRATA_L32_ALLOC_MARGIN_MB, default 0 = off: only STRATA_L32_REGROW_TRACE=1 prints the checks): the store releases whole chunks of pool
|
||||
// slots for the shortfall. Waiting for cudaMalloc to fail is not enough where the driver over-commits (Windows WDDM pages the allocation to shared system memory instead of failing, and the kernels then
|
||||
// read it over PCIe: a 33K-token prompt took 600 s instead of 100 s on a 12 GB card); the failure retry below stays as the backstop.
|
||||
void make_room(size_t bytes) {
|
||||
if (!E.provider_ || E.opt.kv_init_ctx <= 0) return;
|
||||
static const size_t margin = [] { const char* e = std::getenv("STRATA_L32_ALLOC_MARGIN_MB"); return static_cast<size_t>(e && e[0] ? std::max(0, std::atoi(e)) : 256) * 1048576ull; }();
|
||||
static const size_t margin = [] { const char* e = std::getenv("STRATA_L32_ALLOC_MARGIN_MB"); return static_cast<size_t>(e && e[0] ? std::max(0, std::atoi(e)) : 0) * 1048576ull; }();
|
||||
static const bool trace = [] { const char* f = std::getenv("STRATA_L32_REGROW_TRACE"); return f && f[0] == '1'; }();
|
||||
if (margin == 0 && !trace) return; // default: off, exactly the old behaviour (the failure retry below is the only release; a margin of 256 MiB cost 1-3 % of prefill and decode on a Linux 5070 and never fired on Windows, where the planner headroom is the fix)
|
||||
static int n_print = 0; // the first checks of a process are always printed (one short line each, at most 4): the numbers cudaMemGetInfo gives are what decides whether the pool makes room
|
||||
for (int t = 0; t < 64; ++t) {
|
||||
size_t fr = 0, tot = 0;
|
||||
|
||||
@@ -32251,7 +32251,7 @@
|
||||
],
|
||||
"parse": "int",
|
||||
"default_state": null,
|
||||
"code_default": "256",
|
||||
"code_default": "0",
|
||||
"engine_sets": [],
|
||||
"engine_defaults": [],
|
||||
"launch_files": [],
|
||||
@@ -32265,7 +32265,7 @@
|
||||
"last_date": "2026-12-03",
|
||||
"status": "research",
|
||||
"owner": "L32",
|
||||
"note": "MiB of the card the lazy KV / scratch regrow keeps free: before a big allocation the store releases pool chunks when free memory is below the size plus this margin (default 256; Windows WDDM over-commits instead of failing; L32-SMALL)",
|
||||
"note": "MiB of the card the lazy KV / scratch regrow keeps free before a big allocation (the store releases pool chunks when free memory is below the size plus this margin); default 0 = off (the old behaviour: the failure retry is the only release); 256 cost 1-3 % of prefill and decode on a Linux 5070 and never fired on Windows, where STRATA_L32_WDDM_HEADROOM_MB is the fix (L32-SMALL, L32-CUDA)",
|
||||
"retire_after": "",
|
||||
"retired_in": ""
|
||||
},
|
||||
@@ -32547,7 +32547,7 @@
|
||||
},
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 721,
|
||||
"line": 722,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
@@ -32613,7 +32613,7 @@
|
||||
"reads": [
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 507,
|
||||
"line": 508,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
@@ -33102,7 +33102,7 @@
|
||||
"reads": [
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 1953,
|
||||
"line": 1954,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
@@ -33168,7 +33168,7 @@
|
||||
"reads": [
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 1669,
|
||||
"line": 1670,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
@@ -33201,7 +33201,7 @@
|
||||
"reads": [
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 1670,
|
||||
"line": 1671,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
@@ -33273,7 +33273,7 @@
|
||||
"reads": [
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 1787,
|
||||
"line": 1788,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
@@ -34143,7 +34143,7 @@
|
||||
"reads": [
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 1721,
|
||||
"line": 1722,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
@@ -34407,7 +34407,7 @@
|
||||
"reads": [
|
||||
{
|
||||
"file": "engine/src/ling32/ling32_engine.cu",
|
||||
"line": 506,
|
||||
"line": 507,
|
||||
"backend": "cuda-hip",
|
||||
"fn": "getenv"
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user