[HIP] Bound BUF_POOL with a 512MiB cap + LRU hipFree; guard moe_scatter_buckets
The exact-size thread-local BUF_POOL never called hipFree: every distinct batched tail size (bu = suffix % chunk, varies per turn) parked ~100-160MiB forever => unbounded multi-turn VRAM leak (audit 2026-12-02 §2.1). Track POOL_BYTES and hipFree a dropped buffer once the pool exceeds MAX_POOL_BYTES (512MiB); hot fixed-size intermediates still recycle. Also add the symmetric e<0||e>=128 guard to k_moe_scatter_buckets (count_buckets had it) so a corrupt router id cannot write exp_cur out of bounds.
This commit is contained in:
1 parent
088ac1f66d
commit
ac1b55425c
2 files changed
+25
-1
No files matched your search
@@ -2120,6 +2120,7 @@ __global__ void __launch_bounds__(256) k_moe_scatter_buckets(
|
||||
const int i = blockIdx.x * blockDim.x + threadIdx.x;
|
||||
if (i >= total) return;
|
||||
const int e = topk_ids[i];
|
||||
if (e < 0 || e >= 128) return; // symmetric with k_moe_count_buckets: never OOB exp_cur[e]
|
||||
const int pos = atomicAdd(&exp_cur[e], 1);
|
||||
bucket_tok[pos] = i / top_k;
|
||||
slotk_to_bidx[i] = pos;
|
||||
|
||||
Reference in new issue
Block a user