[AMD] Fix EAGLE crash when no kv_index_translator is bound on the DSA fp8 read door (#38318)

This commit is contained in:
jiaryang
2026-09-07 13:03:10 -07:00
committed by GitHub
parent a711785475
commit 6287ebf43a
@@ -656,9 +656,14 @@ class DeepseekMHAForwardMixin:
# reads cached prefix KV crashes with "576 != 656".
kv_indices = filter_dcp_local_kv_indices(kv_indices=kv_indices)
# Read door: the pool never translates, so the production site does.
kv_indices = get_attn_backend().kv_index_translator.translate_dcp_read_ids(
kv_indices
)
# Only the FlashAttention/FlashInfer backends bind a translator; the
# base class documents its None default as "no translate", and the DSA
# backend the EAGLE draft model runs on keeps that default. With no
# translator the ids never went VIRTUAL, so there is nothing to
# collapse.
translator = get_attn_backend().kv_index_translator
if translator is not None:
kv_indices = translator.translate_dcp_read_ids(kv_indices)
kv_a, k_pe = get_token_to_kv_pool().get_mla_kv_buffer(
self.attn_mha, kv_indices, torch.bfloat16
)