[AMD][Fix] AgentX HIP TPOT regression when SGLANG_SIMULATE_ACC_LEN is set (#40598)

This commit is contained in:
jacky.cheng
2026-09-21 19:16:15 -07:00
committed by GitHub
parent 9eda772a21
commit bc30fa1759
2 changed files with 14 additions and 0 deletions
@@ -16,6 +16,7 @@ from sglang.srt.arg_groups.overrides import (
resolving_view,
run_post_process_pass,
)
from sglang.srt.environ import envs
from sglang.srt.platforms import current_platform
from sglang.srt.runtime_context import get_platform
@@ -35,6 +36,7 @@ def _should_auto_enable_hip_rejection_sampling(
accept_threshold_single: float,
accept_threshold_acc: float,
enable_deterministic_inference: bool,
simulate_acc_len: float = -1.0,
) -> bool:
"""Whether HIP may default ``speculative_use_rejection_sampling`` on.
@@ -43,6 +45,10 @@ def _should_auto_enable_hip_rejection_sampling(
would crash configs that previously ran greedy on HIP, including EAGLE3
stage-a ``test_basic_sanity_eagle3`` (draft 32000 vs target 128256). Skip
EAGLE3 and any EAGLE run that already has a token map.
Also skip when ``SGLANG_SIMULATE_ACC_LEN`` is on: AgentX throughput still
runs the real EAGLE verify then overwrites accept length, so the Triton
chain sampler is paid for and thrown away.
"""
return (
is_hip
@@ -53,6 +59,7 @@ def _should_auto_enable_hip_rejection_sampling(
and accept_threshold_single == 1.0
and accept_threshold_acc == 1.0
and not enable_deterministic_inference
and simulate_acc_len <= 0
)
@@ -1025,6 +1032,7 @@ def _handle_eagle_family(server_args: ServerArgs) -> None:
accept_threshold_single=cfg.speculative_accept_threshold_single,
accept_threshold_acc=cfg.speculative_accept_threshold_acc,
enable_deterministic_inference=cfg.enable_deterministic_inference,
simulate_acc_len=float(envs.SGLANG_SIMULATE_ACC_LEN.get()),
):
declare_resolution(
server_args,
@@ -122,6 +122,12 @@ class TestHipAutoEnableRejectionSampling(CustomTestCase):
def test_already_on_is_a_no_op(self):
self.assertFalse(_hip_auto_enable(use_rejection_sampling=True))
def test_simulate_acc_len_stays_off(self):
# AgentX throughput overwrites accept after real verify; skip the
# Triton chain sampler so HIP stays on the greedy argmax path.
self.assertFalse(_hip_auto_enable(simulate_acc_len=3.39))
self.assertTrue(_hip_auto_enable(simulate_acc_len=-1.0))
if __name__ == "__main__":
unittest.main()