[AMD] Scope the EAGLE greedy-verify TP broadcast to ROCm only (#35195)
This commit is contained in:
@@ -737,6 +737,21 @@ def eagle_sample(
|
|||||||
target_predict=target_predict,
|
target_predict=target_predict,
|
||||||
topk=verify_input.tree_topk,
|
topk=verify_input.tree_topk,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if _is_hip:
|
||||||
|
# On ROCm, the per-rank draft tokens can differ, so ranks accept a
|
||||||
|
# different number of drafts, desynchronize the committed seq_lens, and
|
||||||
|
# deadlock the next TP collective. Broadcast from rank 0 to ensure
|
||||||
|
# consistency, the same way the sampling branch below does.
|
||||||
|
tp_group = (
|
||||||
|
get_parallel().attn_tp_group
|
||||||
|
if is_dp_attention_enabled()
|
||||||
|
else get_tp_group()
|
||||||
|
)
|
||||||
|
if tp_group.world_size > 1:
|
||||||
|
tp_group.broadcast(predict, src=0)
|
||||||
|
tp_group.broadcast(accept_index, src=0)
|
||||||
|
tp_group.broadcast(num_correct_drafts, src=0)
|
||||||
else:
|
else:
|
||||||
from sgl_kernel import (
|
from sgl_kernel import (
|
||||||
top_k_renorm_prob,
|
top_k_renorm_prob,
|
||||||
@@ -824,17 +839,19 @@ def eagle_sample(
|
|||||||
deterministic=True,
|
deterministic=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Sync the verify decision across TP ranks: small per-rank differences in the
|
# Sync sampling results across TP ranks: different GPUs may
|
||||||
# tensors feeding this point can make one rank accept a different number of
|
# produce slightly different target_probs due to floating-point
|
||||||
# drafts, which desynchronizes the committed seq_lens and deadlocks the next
|
# non-determinism in softmax/top_k/top_p, causing different
|
||||||
# TP collective. Broadcast from rank 0 to ensure consistency.
|
# sampled tokens. Broadcast from rank 0 to ensure consistency.
|
||||||
tp_group = (
|
tp_group = (
|
||||||
get_parallel().attn_tp_group if is_dp_attention_enabled() else get_tp_group()
|
get_parallel().attn_tp_group
|
||||||
)
|
if is_dp_attention_enabled()
|
||||||
if tp_group.world_size > 1:
|
else get_tp_group()
|
||||||
tp_group.broadcast(predict, src=0)
|
)
|
||||||
tp_group.broadcast(accept_index, src=0)
|
if tp_group.world_size > 1:
|
||||||
tp_group.broadcast(num_correct_drafts, src=0)
|
tp_group.broadcast(predict, src=0)
|
||||||
|
tp_group.broadcast(accept_index, src=0)
|
||||||
|
tp_group.broadcast(num_correct_drafts, src=0)
|
||||||
|
|
||||||
if SIMULATE_ACC_LEN > 0:
|
if SIMULATE_ACC_LEN > 0:
|
||||||
# Do simulation. The helper builds (and returns) a replacement
|
# Do simulation. The helper builds (and returns) a replacement
|
||||||
|
|||||||
Reference in New Issue
Block a user