[Test] Add fwd_occupancy sanity kit (#25886)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Basic sanity: small-but-broad server smoke that downstream stages
|
||||
depend on. Three sanity kits, one shared server, covering protocol
|
||||
contract, decode correctness, and scheduler stress paths."""
|
||||
"""Stage-a basic sanity: small-but-broad server smoke that downstream
|
||||
stages depend on. Multiple sanity-kit mixins driving one shared server,
|
||||
covering protocol, decode correctness, scheduler stress, occupancy, and
|
||||
hellaswag accuracy."""
|
||||
|
||||
import unittest
|
||||
|
||||
@@ -9,6 +10,8 @@ from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
|
||||
from sglang.test.kits.basic_api_contract_kit import BasicAPIContractMixin
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.kits.basic_scheduler_stress_kit import BasicSchedulerStressMixin
|
||||
from sglang.test.kits.fwd_occupancy_kit import FwdOccupancyMixin
|
||||
from sglang.test.kits.hellaswag_kit import HellaswagMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_MODEL_NAME_FOR_TEST,
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
@@ -17,17 +20,22 @@ from sglang.test.test_utils import (
|
||||
popen_launch_server,
|
||||
)
|
||||
|
||||
register_cuda_ci(est_time=120, stage="base-a", runner_config="1-gpu-small")
|
||||
register_amd_ci(est_time=120, suite="stage-a-test-1-gpu-small-amd")
|
||||
register_cuda_ci(est_time=160, stage="base-a", runner_config="1-gpu-small")
|
||||
register_amd_ci(est_time=160, suite="stage-a-test-1-gpu-small-amd")
|
||||
|
||||
|
||||
class TestBasicSanity(
|
||||
BasicAPIContractMixin,
|
||||
BasicDecodeCorrectnessMixin,
|
||||
BasicSchedulerStressMixin,
|
||||
FwdOccupancyMixin,
|
||||
HellaswagMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
served_model_name = DEFAULT_MODEL_NAME_FOR_TEST
|
||||
# 5090 + Llama-3.1-8B single-batch decode with overlap scheduler +
|
||||
# cuda graph measured ~99 median in CI; keep ~2pp headroom.
|
||||
fwd_occupancy_threshold = 97.0
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
@@ -43,32 +51,13 @@ class TestBasicSanity(
|
||||
"0.7",
|
||||
"--enable-metrics",
|
||||
],
|
||||
env={"SGLANG_ENABLE_METRICS_DEVICE_TIMER": "1"},
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
def test_accuracy_floor(self):
|
||||
# Stage-a-private accuracy guard: hellaswag via the frontend DSL
|
||||
# bound to this server. Catches systematic regressions that pass
|
||||
# every cheap probe in the mixed-in kits but tank multi-choice
|
||||
# reasoning. Not part of any reusable mixin -- accuracy gating
|
||||
# is the gate test's own responsibility.
|
||||
import sglang as sgl
|
||||
from sglang.test.test_programs import test_hellaswag_select
|
||||
|
||||
sgl.set_default_backend(sgl.RuntimeEndpoint(self.base_url))
|
||||
try:
|
||||
accuracy, _ = test_hellaswag_select()
|
||||
finally:
|
||||
sgl.set_default_backend(None)
|
||||
self.assertGreater(
|
||||
accuracy,
|
||||
0.60,
|
||||
f"hellaswag accuracy floor breached: {accuracy:.3f}",
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
"""Stage-a basic sanity with EAGLE3 spec decoding enabled. Mirrors
|
||||
test_basic_sanity.py with the spec-decoding path active."""
|
||||
|
||||
import unittest
|
||||
|
||||
from sglang.srt.utils import kill_process_tree
|
||||
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
|
||||
from sglang.test.kits.basic_api_contract_kit import BasicAPIContractMixin
|
||||
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
|
||||
from sglang.test.kits.basic_scheduler_stress_kit import BasicSchedulerStressMixin
|
||||
from sglang.test.kits.fwd_occupancy_kit import FwdOccupancyMixin
|
||||
from sglang.test.kits.hellaswag_kit import HellaswagMixin
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_DRAFT_MODEL_EAGLE3,
|
||||
DEFAULT_TARGET_MODEL_EAGLE3,
|
||||
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
CustomTestCase,
|
||||
popen_launch_server,
|
||||
)
|
||||
|
||||
register_cuda_ci(est_time=200, stage="base-a", runner_config="1-gpu-small")
|
||||
register_amd_ci(est_time=200, suite="stage-a-test-1-gpu-small-amd")
|
||||
|
||||
|
||||
class TestBasicSanityEagle3(
|
||||
BasicAPIContractMixin,
|
||||
BasicDecodeCorrectnessMixin,
|
||||
BasicSchedulerStressMixin,
|
||||
FwdOccupancyMixin,
|
||||
HellaswagMixin,
|
||||
CustomTestCase,
|
||||
):
|
||||
served_model_name = DEFAULT_TARGET_MODEL_EAGLE3
|
||||
# Match vanilla gate at 97; EAGLE3 spec should sustain similar
|
||||
# single-batch occupancy. Adjust per CI calibration.
|
||||
fwd_occupancy_threshold = 97.0
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.process = popen_launch_server(
|
||||
DEFAULT_TARGET_MODEL_EAGLE3,
|
||||
cls.base_url,
|
||||
timeout=DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
|
||||
other_args=[
|
||||
# Canonical EAGLE3 sglang config: fp16 + triton attention.
|
||||
# bf16 + flashinfer cutlass RMSNorm hits a SM120 dtype
|
||||
# mismatch on the draft model's input_layernorm.
|
||||
"--dtype",
|
||||
"float16",
|
||||
"--attention-backend",
|
||||
"triton",
|
||||
"--speculative-algorithm",
|
||||
"EAGLE3",
|
||||
"--speculative-draft-model-path",
|
||||
DEFAULT_DRAFT_MODEL_EAGLE3,
|
||||
"--speculative-num-steps",
|
||||
"3",
|
||||
"--speculative-eagle-topk",
|
||||
"1",
|
||||
"--speculative-num-draft-tokens",
|
||||
"4",
|
||||
"--cuda-graph-max-bs",
|
||||
"4",
|
||||
"--mem-fraction-static",
|
||||
"0.7",
|
||||
"--enable-metrics",
|
||||
],
|
||||
env={"SGLANG_ENABLE_METRICS_DEVICE_TIMER": "1"},
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
kill_process_tree(cls.process.pid)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user