[AMD] Add DeepSeek-V3.2 and VLMs model in nightly tests (#17179)
Co-authored-by: michaelzhang-ai <michaelzhang-ai@users.noreply.github.com> Co-authored-by: YC Tseng <yctseng@amd.com> Co-authored-by: Bingxu Chen <bingxche@amd.com>
This commit is contained in:
co-authored by
michaelzhang-ai
YC Tseng
Bingxu Chen
parent
6988a0f570
commit
a3addd6203
@@ -30,7 +30,10 @@ register_amd_ci(
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns."""
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
@@ -43,7 +46,14 @@ def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
for result in results:
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
@@ -82,7 +92,7 @@ class TestDeepseekR1MXFP4PerfMI35x(unittest.TestCase):
|
||||
cls.model = get_model_path()
|
||||
print(f"Using model path: {cls.model}")
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 1, 8, 16, 64]
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "4096"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
"""MI35x Nightly performance benchmark for DeepSeek-V3.2 model (basic variant).
|
||||
|
||||
This test benchmarks the DeepSeek-V3.2 model with basic TP=8 configuration on 8 GPUs.
|
||||
|
||||
The model path can be configured via DEEPSEEK_V32_MODEL_PATH environment variable.
|
||||
|
||||
Registry: nightly-perf-8-gpu-mi35x-deepseek-v32-basic suite
|
||||
|
||||
Example usage:
|
||||
DEEPSEEK_V32_MODEL_PATH=deepseek-ai/DeepSeek-V3.2 python -m pytest test_deepseek_v32_basic_perf_mi35x.py -v
|
||||
"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from typing import List
|
||||
|
||||
from sglang.test.ci.ci_register import register_amd_ci
|
||||
from sglang.test.nightly_bench_utils import BenchmarkResult
|
||||
from sglang.test.nightly_utils import NightlyBenchmarkRunner
|
||||
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST, _parse_int_list_env
|
||||
|
||||
# Register for AMD CI - DeepSeek-V3.2 basic benchmark (~90 min)
|
||||
register_amd_ci(
|
||||
est_time=5400, suite="nightly-perf-8-gpu-mi35x-deepseek-v32-basic", nightly=True
|
||||
)
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
|
||||
gpu_config = os.getenv("GPU_CONFIG", "MI35x")
|
||||
if gpu_config:
|
||||
model_header += f" [{gpu_config}]"
|
||||
|
||||
summary = f"### {model_header}\n"
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
# Model path can be overridden via environment variable
|
||||
DEEPSEEK_V32_MODEL_PATH = os.environ.get(
|
||||
"DEEPSEEK_V32_MODEL_PATH", "deepseek-ai/DeepSeek-V3.2"
|
||||
)
|
||||
PROFILE_DIR = "performance_profiles_deepseek_v32_basic"
|
||||
|
||||
|
||||
class TestNightlyDeepseekV32BasicPerformance(unittest.TestCase):
|
||||
"""MI35x Nightly performance benchmark for DeepSeek-V3.2 model (basic variant).
|
||||
|
||||
Tests the DeepSeek-V3.2 model with basic TP=8 configuration.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = DEEPSEEK_V32_MODEL_PATH
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "4096"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
# Basic variant configuration for DeepSeek-V3.2
|
||||
# MI35x uses tilelang NSA backends
|
||||
cls.variant_config = {
|
||||
"name": "basic",
|
||||
"other_args": [
|
||||
"--trust-remote-code",
|
||||
"--tp",
|
||||
"8",
|
||||
"--nsa-prefill-backend",
|
||||
"tilelang",
|
||||
"--nsa-decode-backend",
|
||||
"tilelang",
|
||||
"--mem-fraction-static",
|
||||
"0.85",
|
||||
"--model-loader-extra-config",
|
||||
'{"enable_multithread_load": true}',
|
||||
],
|
||||
}
|
||||
|
||||
cls.runner = NightlyBenchmarkRunner(PROFILE_DIR, cls.__name__, cls.base_url)
|
||||
cls.runner.setup_profile_directory()
|
||||
# Override full_report to remove traces help text
|
||||
cls.runner.full_report = f"## {cls.__name__}\n"
|
||||
|
||||
def test_bench_one_batch(self):
|
||||
"""Run benchmark for basic variant."""
|
||||
try:
|
||||
result_tuple = self.runner.run_benchmark_for_model(
|
||||
model_path=self.model,
|
||||
batch_sizes=self.batch_sizes,
|
||||
input_lens=self.input_lens,
|
||||
output_lens=self.output_lens,
|
||||
other_args=self.variant_config["other_args"],
|
||||
variant=self.variant_config["name"],
|
||||
extra_bench_args=["--trust-remote-code"],
|
||||
)
|
||||
results = result_tuple[0]
|
||||
success = result_tuple[1]
|
||||
|
||||
# Use simplified report format without traces
|
||||
if results:
|
||||
self.runner.full_report += (
|
||||
generate_simple_markdown_report(results) + "\n"
|
||||
)
|
||||
|
||||
if not success:
|
||||
raise AssertionError(
|
||||
f"Benchmark failed for {self.model} (basic variant)"
|
||||
)
|
||||
finally:
|
||||
self.runner.write_final_report()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,146 @@
|
||||
"""MI35x Nightly performance benchmark for DeepSeek-V3.2 model (MTP variant).
|
||||
|
||||
This test benchmarks the DeepSeek-V3.2 model with MTP (EAGLE speculative decoding)
|
||||
configuration on 8 GPUs.
|
||||
|
||||
The model path can be configured via DEEPSEEK_V32_MODEL_PATH environment variable.
|
||||
|
||||
Registry: nightly-perf-8-gpu-mi35x-deepseek-v32-mtp suite
|
||||
|
||||
Example usage:
|
||||
DEEPSEEK_V32_MODEL_PATH=deepseek-ai/DeepSeek-V3.2 python -m pytest test_deepseek_v32_mtp_perf_mi35x.py -v
|
||||
"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from typing import List
|
||||
|
||||
from sglang.test.ci.ci_register import register_amd_ci
|
||||
from sglang.test.nightly_bench_utils import BenchmarkResult
|
||||
from sglang.test.nightly_utils import NightlyBenchmarkRunner
|
||||
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST, _parse_int_list_env
|
||||
|
||||
# Register for AMD CI - DeepSeek-V3.2 MTP benchmark (~90 min)
|
||||
register_amd_ci(
|
||||
est_time=5400, suite="nightly-perf-8-gpu-mi35x-deepseek-v32-mtp", nightly=True
|
||||
)
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
|
||||
gpu_config = os.getenv("GPU_CONFIG", "MI35x")
|
||||
if gpu_config:
|
||||
model_header += f" [{gpu_config}]"
|
||||
|
||||
summary = f"### {model_header}\n"
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
# Model path can be overridden via environment variable
|
||||
DEEPSEEK_V32_MODEL_PATH = os.environ.get(
|
||||
"DEEPSEEK_V32_MODEL_PATH", "deepseek-ai/DeepSeek-V3.2"
|
||||
)
|
||||
PROFILE_DIR = "performance_profiles_deepseek_v32_mtp"
|
||||
|
||||
|
||||
class TestNightlyDeepseekV32MTPPerformance(unittest.TestCase):
|
||||
"""MI35x Nightly performance benchmark for DeepSeek-V3.2 model (MTP variant).
|
||||
|
||||
Tests the DeepSeek-V3.2 model with MTP (EAGLE speculative decoding) on TP=8.
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.model = DEEPSEEK_V32_MODEL_PATH
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "4096"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
# MTP variant configuration for DeepSeek-V3.2
|
||||
# MI35x uses tilelang NSA backends + EAGLE speculative decoding
|
||||
cls.variant_config = {
|
||||
"name": "mtp",
|
||||
"other_args": [
|
||||
"--trust-remote-code",
|
||||
"--tp",
|
||||
"8",
|
||||
"--nsa-prefill-backend",
|
||||
"tilelang",
|
||||
"--nsa-decode-backend",
|
||||
"tilelang",
|
||||
"--speculative-algorithm",
|
||||
"EAGLE",
|
||||
"--speculative-num-steps",
|
||||
"3",
|
||||
"--speculative-eagle-topk",
|
||||
"1",
|
||||
"--speculative-num-draft-tokens",
|
||||
"4",
|
||||
"--mem-fraction-static",
|
||||
"0.7",
|
||||
"--model-loader-extra-config",
|
||||
'{"enable_multithread_load": true}',
|
||||
],
|
||||
}
|
||||
|
||||
cls.runner = NightlyBenchmarkRunner(PROFILE_DIR, cls.__name__, cls.base_url)
|
||||
cls.runner.setup_profile_directory()
|
||||
# Override full_report to remove traces help text
|
||||
cls.runner.full_report = f"## {cls.__name__}\n"
|
||||
|
||||
def test_bench_one_batch(self):
|
||||
"""Run benchmark for MTP variant."""
|
||||
try:
|
||||
result_tuple = self.runner.run_benchmark_for_model(
|
||||
model_path=self.model,
|
||||
batch_sizes=self.batch_sizes,
|
||||
input_lens=self.input_lens,
|
||||
output_lens=self.output_lens,
|
||||
other_args=self.variant_config["other_args"],
|
||||
variant=self.variant_config["name"],
|
||||
extra_bench_args=["--trust-remote-code"],
|
||||
)
|
||||
results = result_tuple[0]
|
||||
success = result_tuple[1]
|
||||
avg_spec_accept_length = result_tuple[2] if len(result_tuple) > 2 else None
|
||||
|
||||
# Log speculative decoding accept length
|
||||
if avg_spec_accept_length is not None:
|
||||
print(f" avg_spec_accept_length={avg_spec_accept_length:.2f}")
|
||||
|
||||
# Use simplified report format without traces
|
||||
if results:
|
||||
self.runner.full_report += (
|
||||
generate_simple_markdown_report(results) + "\n"
|
||||
)
|
||||
|
||||
if not success:
|
||||
raise AssertionError(f"Benchmark failed for {self.model} (MTP variant)")
|
||||
finally:
|
||||
self.runner.write_final_report()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -21,7 +21,10 @@ register_amd_ci(
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns."""
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
@@ -34,7 +37,14 @@ def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
for result in results:
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
@@ -53,7 +63,7 @@ class TestGrok1INT4PerfMI35x(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 1, 8, 16, 64]
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "1024"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
|
||||
@@ -19,7 +19,10 @@ register_amd_ci(est_time=1500, suite="nightly-perf-8-gpu-mi35x-grok2", nightly=T
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns."""
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
@@ -32,7 +35,14 @@ def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
for result in results:
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
@@ -53,7 +63,7 @@ class TestGrok2PerfMI35x(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 1, 8, 16, 64]
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "1024"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
|
||||
@@ -22,7 +22,10 @@ register_amd_ci(est_time=18000, suite="nightly-perf-8-gpu-deepseek-v31", nightly
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns."""
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
@@ -35,7 +38,14 @@ def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
for result in results:
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
@@ -59,7 +69,7 @@ class TestNightlyDeepseekV31Performance(unittest.TestCase):
|
||||
def setUpClass(cls):
|
||||
cls.model = DEEPSEEK_V31_MODEL_PATH
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 1, 8, 16, 64]
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "4096"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@ register_amd_ci(est_time=1500, suite="nightly-perf-8-gpu-grok1-int4", nightly=Tr
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns."""
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
@@ -37,7 +40,14 @@ def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
for result in results:
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
@@ -60,7 +70,7 @@ class TestNightlyGrok1INT4Performance(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 1, 8, 16, 64]
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "1024"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@ register_amd_ci(est_time=1500, suite="nightly-perf-8-gpu-grok2", nightly=True)
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns."""
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
@@ -37,7 +40,14 @@ def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
for result in results:
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
@@ -62,7 +72,7 @@ class TestNightlyGrok2Performance(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
cls.batch_sizes = [1, 1, 8, 16, 64]
|
||||
cls.batch_sizes = [1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "1024"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
"""AMD Nightly performance benchmark for text models (2-GPU).
|
||||
|
||||
This test benchmarks text models on AMD MI30x/MI35x with 2 GPUs.
|
||||
|
||||
Registry: nightly-amd-perf-text-2-gpu suite
|
||||
|
||||
Example usage:
|
||||
python -m pytest test_text_models_perf_amd.py -v
|
||||
"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
from typing import List
|
||||
|
||||
from sglang.test.ci.ci_register import register_amd_ci
|
||||
from sglang.test.nightly_bench_utils import BenchmarkResult
|
||||
from sglang.test.nightly_utils import NightlyBenchmarkRunner
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
ModelLaunchSettings,
|
||||
_parse_int_list_env,
|
||||
parse_models,
|
||||
)
|
||||
|
||||
# Register for AMD CI - Text models benchmark (~60 min)
|
||||
register_amd_ci(est_time=3600, suite="nightly-amd-perf-text-2-gpu", nightly=True)
|
||||
|
||||
PROFILE_DIR = "performance_profiles_text_models_amd"
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
|
||||
gpu_config = os.getenv("GPU_CONFIG", "AMD")
|
||||
if gpu_config:
|
||||
model_header += f" [{gpu_config}]"
|
||||
|
||||
summary = f"### {model_header}\n"
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
class TestNightlyTextModelsPerfAMD(unittest.TestCase):
|
||||
"""AMD Nightly performance benchmark for text models (2-GPU)."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
cls.models = []
|
||||
# Llama-3.1-8B on TP=1
|
||||
for model_path in parse_models("meta-llama/Llama-3.1-8B-Instruct"):
|
||||
cls.models.append(
|
||||
ModelLaunchSettings(
|
||||
model_path,
|
||||
tp_size=1,
|
||||
extra_args=["--attention-backend", "aiter"],
|
||||
)
|
||||
)
|
||||
# Qwen2-57B MoE on TP=2
|
||||
for model_path in parse_models("Qwen/Qwen2-57B-A14B-Instruct"):
|
||||
cls.models.append(
|
||||
ModelLaunchSettings(
|
||||
model_path,
|
||||
tp_size=2,
|
||||
extra_args=["--attention-backend", "aiter"],
|
||||
)
|
||||
)
|
||||
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
# First batch_size=1 is warmup (standalone job, no accuracy test to warm up)
|
||||
cls.batch_sizes = [1, 1, 8, 16, 64]
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_INPUT_LENS", "4096"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_OUTPUT_LENS", "512"))
|
||||
cls.runner = NightlyBenchmarkRunner(PROFILE_DIR, cls.__name__, cls.base_url)
|
||||
cls.runner.setup_profile_directory()
|
||||
cls.runner.full_report = f"## {cls.__name__}\n"
|
||||
|
||||
def test_bench_one_batch(self):
|
||||
"""Run benchmark for all configured text models."""
|
||||
all_model_succeed = True
|
||||
|
||||
try:
|
||||
for model_setup in self.models:
|
||||
with self.subTest(model=model_setup.model_path):
|
||||
other_args = list(model_setup.extra_args or [])
|
||||
if model_setup.tp_size and model_setup.tp_size > 1:
|
||||
other_args.extend(["--tp", str(model_setup.tp_size)])
|
||||
|
||||
result_tuple = self.runner.run_benchmark_for_model(
|
||||
model_path=model_setup.model_path,
|
||||
batch_sizes=self.batch_sizes,
|
||||
input_lens=self.input_lens,
|
||||
output_lens=self.output_lens,
|
||||
other_args=other_args,
|
||||
)
|
||||
results = result_tuple[0]
|
||||
success = result_tuple[1]
|
||||
|
||||
if not success:
|
||||
all_model_succeed = False
|
||||
|
||||
if results:
|
||||
self.runner.full_report += (
|
||||
generate_simple_markdown_report(results) + "\n"
|
||||
)
|
||||
finally:
|
||||
self.runner.write_final_report()
|
||||
|
||||
if not all_model_succeed:
|
||||
raise AssertionError("Some models failed the perf tests.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
@@ -0,0 +1,145 @@
|
||||
"""AMD Nightly performance benchmark for VLM models (2-GPU).
|
||||
|
||||
This test benchmarks Vision-Language Models on AMD MI30x/MI35x with 2 GPUs.
|
||||
|
||||
Registry: nightly-amd-perf-vlm-2-gpu suite
|
||||
|
||||
Example usage:
|
||||
python -m pytest test_vlms_perf_amd.py -v
|
||||
"""
|
||||
|
||||
import os
|
||||
import unittest
|
||||
import warnings
|
||||
from typing import List
|
||||
|
||||
from sglang.test.ci.ci_register import register_amd_ci
|
||||
from sglang.test.nightly_bench_utils import BenchmarkResult
|
||||
from sglang.test.nightly_utils import NightlyBenchmarkRunner
|
||||
from sglang.test.test_utils import (
|
||||
DEFAULT_URL_FOR_TEST,
|
||||
ModelLaunchSettings,
|
||||
_parse_int_list_env,
|
||||
parse_models,
|
||||
)
|
||||
|
||||
# Register for AMD CI - VLM models benchmark (~120 min)
|
||||
register_amd_ci(est_time=7200, suite="nightly-amd-perf-vlm-2-gpu", nightly=True)
|
||||
|
||||
PROFILE_DIR = "performance_profiles_vlms_amd"
|
||||
|
||||
# VLM models suitable for AMD
|
||||
MODEL_DEFAULTS = [
|
||||
ModelLaunchSettings(
|
||||
"Qwen/Qwen2.5-VL-7B-Instruct",
|
||||
extra_args=["--mem-fraction-static=0.7"],
|
||||
),
|
||||
ModelLaunchSettings(
|
||||
"Qwen/Qwen3-VL-30B-A3B-Instruct",
|
||||
tp_size=2,
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
def generate_simple_markdown_report(results: List[BenchmarkResult]) -> str:
|
||||
"""Generate a simplified markdown report without traces and cost columns.
|
||||
|
||||
Skips the first result if it's a warmup run (duplicate batch_size).
|
||||
"""
|
||||
model_header = results[0].model_path
|
||||
if results[0].run_name and results[0].run_name != "default":
|
||||
model_header += f" ({results[0].run_name})"
|
||||
|
||||
gpu_config = os.getenv("GPU_CONFIG", "AMD")
|
||||
if gpu_config:
|
||||
model_header += f" [{gpu_config}]"
|
||||
|
||||
summary = f"### {model_header}\n"
|
||||
summary += "| batch size | input len | latency (s) | input throughput (tok/s) | output throughput (tok/s) | ITL (ms) |\n"
|
||||
summary += "| ---------- | --------- | ----------- | ------------------------ | ------------------------- | -------- |\n"
|
||||
|
||||
# Skip first result if it's a warmup (same batch_size as second result)
|
||||
report_results = (
|
||||
results[1:]
|
||||
if len(results) > 1 and results[0].batch_size == results[1].batch_size
|
||||
else results
|
||||
)
|
||||
|
||||
for result in report_results:
|
||||
itl = 1 / (result.output_throughput / result.batch_size) * 1000
|
||||
summary += f"| {result.batch_size} | {result.input_len} | {result.latency:.2f} | {result.input_throughput:.2f} | {result.output_throughput:.2f} | {itl:.2f} |\n"
|
||||
|
||||
return summary
|
||||
|
||||
|
||||
class TestNightlyVLMsPerfAMD(unittest.TestCase):
|
||||
"""AMD Nightly performance benchmark for VLM models (2-GPU)."""
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
warnings.filterwarnings(
|
||||
"ignore", category=ResourceWarning, message="unclosed.*socket"
|
||||
)
|
||||
|
||||
nightly_vlm_models_str = os.environ.get("NIGHTLY_VLM_MODELS")
|
||||
if nightly_vlm_models_str:
|
||||
cls.models = []
|
||||
model_paths = parse_models(nightly_vlm_models_str)
|
||||
for model_path in model_paths:
|
||||
cls.models.append(ModelLaunchSettings(model_path))
|
||||
else:
|
||||
cls.models = MODEL_DEFAULTS
|
||||
|
||||
cls.base_url = DEFAULT_URL_FOR_TEST
|
||||
# First batch_size=1 is warmup (standalone job, no accuracy test to warm up)
|
||||
cls.batch_sizes = _parse_int_list_env("NIGHTLY_VLM_BATCH_SIZES", "1,1,2,8,16")
|
||||
cls.input_lens = tuple(_parse_int_list_env("NIGHTLY_VLM_INPUT_LENS", "4096"))
|
||||
cls.output_lens = tuple(_parse_int_list_env("NIGHTLY_VLM_OUTPUT_LENS", "512"))
|
||||
cls.runner = NightlyBenchmarkRunner(PROFILE_DIR, cls.__name__, cls.base_url)
|
||||
cls.runner.setup_profile_directory()
|
||||
cls.runner.full_report = f"## {cls.__name__}\n"
|
||||
|
||||
def test_bench_one_batch(self):
|
||||
"""Run benchmark for all configured VLM models."""
|
||||
all_model_succeed = True
|
||||
|
||||
try:
|
||||
for model_setup in self.models:
|
||||
with self.subTest(model=model_setup.model_path):
|
||||
other_args = list(model_setup.extra_args or [])
|
||||
if model_setup.tp_size and model_setup.tp_size > 1:
|
||||
other_args.extend(["--tp", str(model_setup.tp_size)])
|
||||
|
||||
# VLMs need additional benchmark args for dataset and trust-remote-code
|
||||
extra_bench_args = [
|
||||
"--trust-remote-code",
|
||||
"--dataset-name=mmmu",
|
||||
]
|
||||
|
||||
result_tuple = self.runner.run_benchmark_for_model(
|
||||
model_path=model_setup.model_path,
|
||||
batch_sizes=self.batch_sizes,
|
||||
input_lens=self.input_lens,
|
||||
output_lens=self.output_lens,
|
||||
other_args=other_args,
|
||||
extra_bench_args=extra_bench_args,
|
||||
)
|
||||
results = result_tuple[0]
|
||||
success = result_tuple[1]
|
||||
|
||||
if not success:
|
||||
all_model_succeed = False
|
||||
|
||||
if results:
|
||||
self.runner.full_report += (
|
||||
generate_simple_markdown_report(results) + "\n"
|
||||
)
|
||||
finally:
|
||||
self.runner.write_final_report()
|
||||
|
||||
if not all_model_succeed:
|
||||
raise AssertionError("Some models failed the perf tests.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Reference in New Issue
Block a user