gfx12: the 16384 auto prompt chunk stays at 8192 when the RAM available does not cover its extra prompt loan (#2090)
The gfx12 default (0.1.43) lets a bare --prefill auto reach 16384, which lends the prompt path about twice the cache slots of 8192 (R9700, Swift 1.5 IQ3_XXS: 3,907 slots / 6.38 GiB against 2,068 / 3.37 GiB); the lent slots' experts are read from the RAM side during the read. On a 30 GB PC with --resident-experts 38-47K prompts went 20 GB into swap with 1.5M major faults and the engine was killed; --prefill 8192 ran them at ~95 tok/s (bdwilton in #2090). At start, when the engine's own 16384 ceiling is in effect, the extra slots of a 16384 loan over an 8192 one are priced at the largest blob; if the RAM available (the cgroup or --memory-limit-mib cap included) is below that plus 4 GiB, the ceiling stays at 8192 and a line says why. STRATA_GFX12_CHUNK=1 keeps 16384; an explicit --prefill N / auto:N is never touched (the 16384 default only applies to a bare auto).
This commit is contained in:
1 parent
b5217c8bb7
commit
1a55fc3788
1 file changed
+22
@@ -6420,6 +6420,28 @@ int main(int argc, char** argv) {
|
||||
o.prefill_chunk = std::min<int64_t>(o.prefill_chunk, 8192);
|
||||
}
|
||||
}
|
||||
// #2090 (bdwilton): the gfx12 16384 ceiling lends the prompt path about twice the slots of 8192 (R9700, Swift 1.5
|
||||
// IQ3_XXS: 3,907 slots / 6.38 GiB against 2,068 / 3.37 GiB), and every lent slot's expert is read from the RAM side
|
||||
// during the read. On a 30 GB PC with --resident-experts that was 3.4 GB available, 20 GB in swap, 1.5M major faults
|
||||
// and a killed engine on 38-47K prompts; 8192 ran them at 95 tok/s. The ceiling is the engine's default, not the
|
||||
// user's pick, so when the RAM available now does not cover the extra loan plus 4 GiB the default stays at 8192.
|
||||
// STRATA_GFX12_CHUNK=1 keeps 16384 anyway.
|
||||
if (o.prefill_gfx12_16k && auto_ceiling > 8192) {
|
||||
static const char* force16 = std::getenv("STRATA_GFX12_CHUNK");
|
||||
const int64_t extra_slots = std::max<int64_t>(0, lend_slots(16384) - lend_slots(8192));
|
||||
const uint64_t extra_mib = ((uint64_t) extra_slots * strata::kernels::cpu::expert_layout().max_blob) >> 20;
|
||||
const auto hm = strata::core::sample_host_memory(); // the cgroup / --memory-limit-mib cap counts too
|
||||
const uint64_t avail_mib = hm ? hm->available >> 20 : mem_sample().avail_mib;
|
||||
if (avail_mib > 0 && avail_mib < extra_mib + 4096 && !(force16 != nullptr && force16[0] == '1')) {
|
||||
auto_ceiling = std::min<int64_t>(auto_ceiling, 8192);
|
||||
o.prefill_auto_max = std::min<int64_t>(o.prefill_auto_max, 8192);
|
||||
o.prefill_chunk = std::min<int64_t>(o.prefill_chunk, 8192);
|
||||
std::fprintf(stderr, "strata generate: gfx12: prompt chunks stay at 8192: 16384 would lend %lld more cache slots "
|
||||
"(%llu MiB read from RAM during a prompt) and %llu MiB of RAM is available (#2090; "
|
||||
"STRATA_GFX12_CHUNK=1 takes 16384 anyway)\n",
|
||||
(long long) extra_slots, (unsigned long long) extra_mib, (unsigned long long) avail_mib);
|
||||
}
|
||||
}
|
||||
if (o.prefill_auto_cap > 0) auto_ceiling = std::min<int64_t>(auto_ceiling, o.prefill_auto_cap); // #1630
|
||||
// The auto scan used to walk a fixed list of sizes - 32768, 16384, 8192, 6144, ... - and take the first that
|
||||
// fit. That list is coarse exactly where a rig needs it: this one affords ~8,700 tokens and was handed 8192,
|
||||
|
||||
Reference in new issue
Block a user