[AMD] Fix DeepSeek V4 MTP accuracy issue (#30333)

This commit is contained in:
Wang, FangYuan
2026-07-06 23:57:57 -07:00
committed by GitHub
parent 669fd4b8a5
commit 9a6f8e5992
@@ -129,7 +129,16 @@ class CompressStatePool:
dtype=dtype, device=device, enable_memory_saver=enable_memory_saver
)
if not online:
self.kv_score_buffer[-1].clear()
if _is_hip and ratio == 128:
# Request-scoped C128 state is addressed by req_pool_idx (or a
# per-request ring). The pool is allocated with torch.empty(),
# so a cold server can otherwise read uninitialized partial
# states before a request slot has been written for the first
# time. Initialize all C128 rows to the empty-state sentinel;
# C4 keeps the historical last-row sentinel behavior.
self.kv_score_buffer.clear()
else:
self.kv_score_buffer[-1].clear()
def _alloc_kv_score_buffer(
self, *, dtype: torch.dtype, device: str, enable_memory_saver: bool