[Fix] [AMD] mhc: Bound the Triton fused post+pre buffer cache (#44443)

Co-authored-by: inkcherry <mingzhi.liu@amd.com>
This commit is contained in:
Niko Ma
2026-10-19 01:37:50 -07:00
committed by GitHub
co-authored by inkcherry
parent 8111841103
commit a90e9c5dd8
2 changed files with 34 additions and 1 deletions
@@ -168,7 +168,10 @@ def _get_fused_hc_post_pre_buffers(
num_ksplit, num_tokens, dtype=torch.float32, device=device
),
}
_FUSED_HC_POST_PRE_CACHE[key] = bufs
# Cache only small batches: a caller that runs this path for every prefill
# size (gfx1250) would otherwise keep one buffer set per num_tokens forever.
if num_tokens <= _FUSED_HC_POST_PRE_M_THRESHOLD:
_FUSED_HC_POST_PRE_CACHE[key] = bufs
return bufs