[AMD][Fix] AgentX HIP TPOT regression when SGLANG_SIMULATE_ACC_LEN is set (#40598)
This commit is contained in:
@@ -16,6 +16,7 @@ from sglang.srt.arg_groups.overrides import (
|
|||||||
resolving_view,
|
resolving_view,
|
||||||
run_post_process_pass,
|
run_post_process_pass,
|
||||||
)
|
)
|
||||||
|
from sglang.srt.environ import envs
|
||||||
from sglang.srt.platforms import current_platform
|
from sglang.srt.platforms import current_platform
|
||||||
from sglang.srt.runtime_context import get_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_single: float,
|
||||||
accept_threshold_acc: float,
|
accept_threshold_acc: float,
|
||||||
enable_deterministic_inference: bool,
|
enable_deterministic_inference: bool,
|
||||||
|
simulate_acc_len: float = -1.0,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Whether HIP may default ``speculative_use_rejection_sampling`` on.
|
"""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
|
would crash configs that previously ran greedy on HIP, including EAGLE3
|
||||||
stage-a ``test_basic_sanity_eagle3`` (draft 32000 vs target 128256). Skip
|
stage-a ``test_basic_sanity_eagle3`` (draft 32000 vs target 128256). Skip
|
||||||
EAGLE3 and any EAGLE run that already has a token map.
|
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 (
|
return (
|
||||||
is_hip
|
is_hip
|
||||||
@@ -53,6 +59,7 @@ def _should_auto_enable_hip_rejection_sampling(
|
|||||||
and accept_threshold_single == 1.0
|
and accept_threshold_single == 1.0
|
||||||
and accept_threshold_acc == 1.0
|
and accept_threshold_acc == 1.0
|
||||||
and not enable_deterministic_inference
|
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_single=cfg.speculative_accept_threshold_single,
|
||||||
accept_threshold_acc=cfg.speculative_accept_threshold_acc,
|
accept_threshold_acc=cfg.speculative_accept_threshold_acc,
|
||||||
enable_deterministic_inference=cfg.enable_deterministic_inference,
|
enable_deterministic_inference=cfg.enable_deterministic_inference,
|
||||||
|
simulate_acc_len=float(envs.SGLANG_SIMULATE_ACC_LEN.get()),
|
||||||
):
|
):
|
||||||
declare_resolution(
|
declare_resolution(
|
||||||
server_args,
|
server_args,
|
||||||
|
|||||||
@@ -122,6 +122,12 @@ class TestHipAutoEnableRejectionSampling(CustomTestCase):
|
|||||||
def test_already_on_is_a_no_op(self):
|
def test_already_on_is_a_no_op(self):
|
||||||
self.assertFalse(_hip_auto_enable(use_rejection_sampling=True))
|
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__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|||||||
Reference in New Issue
Block a user