Archived
vram: charge the runtime's resident queue scratch to the card budget
Once a kernel with a private segment has been dispatched (rad_step_advance has 544 bytes a lane), the HSA runtime hands its queue scratch memory and keeps it: about +114 MiB on a card after the first speculative step, +150 MiB with a larger segment, with or without HSA_NO_SCRATCH_RECLAIM. The VRAM budget does not count it, so a serving process was left with only 27-65 MiB free after its first speculative steps -- a thin margin for any kernel that later takes a bigger private segment (the runtime then faults the queue with OUT_OF_RESOURCES instead of failing the load). The backend now reports rad_dev_resident_scratch_bytes(): 5 MiB per CU (160 MiB on an R9700, which reports 32), over the measured 114-150 MiB, and 0 on the host backend and on unified memory. The engine puts it into VramFacts:: queue_scratch, and the budget charges it with the hardware queues (the resolver, vram_budget_need, and the report line). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b2228c176b
commit
7bd195d394
7 files changed
+57
-5
No files matched your search
@@ -51,8 +51,8 @@ static int resolve(Config& cfg, const std::vector<VramFacts>& per_rank, VramBudg
|
||||
b.arena = std::max(b.arena, f.arena);
|
||||
b.staging = std::max(b.staging, f.staging);
|
||||
b.prefetch = std::max(b.prefetch, f.prefetch);
|
||||
if ((int64_t)f.n_queues * f.queue_bytes > b.queues) {
|
||||
b.queues = (int64_t)f.n_queues * f.queue_bytes;
|
||||
if ((int64_t)f.n_queues * f.queue_bytes + f.queue_scratch > b.queues) {
|
||||
b.queues = (int64_t)f.n_queues * f.queue_bytes + f.queue_scratch;
|
||||
b.n_queues = f.n_queues;
|
||||
b.queue_bytes = f.queue_bytes;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ static int resolve(Config& cfg, const std::vector<VramFacts>& per_rank, VramBudg
|
||||
" --gpu-headroom-mib %10s\n"
|
||||
" activation arena %10s (buffer plan + kernel scratch)\n"
|
||||
" step staging %10s (block tables, media and KV tier staging)\n"
|
||||
" hardware queues %10s (%d at %s each, measured)\n"
|
||||
" hardware queues %10s (%d at %s each, measured, + resident queue scratch)\n"
|
||||
" expert prefetch %10s (its ring of expert units and buffers)\n"
|
||||
" ------------------------------\n"
|
||||
" short by %10s\n"
|
||||
@@ -461,7 +461,7 @@ void vram_budget_need(const std::vector<VramFacts>& per_rank, int64_t* need, int
|
||||
arena = std::max(arena, f.arena);
|
||||
staging = std::max(staging, f.staging);
|
||||
prefetch = std::max(prefetch, f.prefetch);
|
||||
queues = std::max(queues, (int64_t)f.n_queues * f.queue_bytes);
|
||||
queues = std::max(queues, (int64_t)f.n_queues * f.queue_bytes + f.queue_scratch);
|
||||
statics = std::max(statics, f.statics);
|
||||
floor = std::max(floor, f.expert_floor);
|
||||
kv_one = std::max(kv_one, f.kv_one);
|
||||
|
||||
Reference in new issue
Block a user