-
Notifications
You must be signed in to change notification settings - Fork 6.4k
[AMD] Add Qwen3.5-397B FP8 nightly perf benchmarks for MI30x and MI35x #21669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cc460e9
[AMD CI] Add Qwen3.5-397B FP8 nightly perf benchmarks for MI30x and M…
michaelzhang-ai 016f96e
Merge branch 'main' into amd/qwen35-fp8-perf-test
michaelzhang-ai 9bef99f
[AMD CI] Write Qwen3.5 accuracy results to GitHub step summary
michaelzhang-ai 43f2e94
[AMD CI] Switch Qwen3.5 FP8 perf tests to aiter attention backend
michaelzhang-ai c000b9d
[AMD CI] Switch Qwen3.5 accuracy tests to aiter attention backend
michaelzhang-ai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
139 changes: 139 additions & 0 deletions
139
test/registered/amd/perf/mi30x/test_qwen35_fp8_perf_amd.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| """Nightly performance benchmark for Qwen3.5-397B-A17B FP8. | ||
|
|
||
| Tests Qwen3.5-397B-A17B-FP8 (MoE, Hybrid Attention with Gated Delta Networks) | ||
| on 8 GPUs with triton attention backend. | ||
|
|
||
| Model path can be configured via environment variable: | ||
| - QWEN35_FP8_MODEL_PATH: Path to Qwen3.5-FP8 model | ||
| (default: Qwen/Qwen3.5-397B-A17B-FP8) | ||
|
|
||
| Example usage: | ||
| python -m pytest test_qwen35_fp8_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, _parse_int_list_env | ||
|
|
||
| register_amd_ci(est_time=5400, suite="nightly-perf-8-gpu-qwen35-fp8", 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", "MI325") | ||
| 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" | ||
|
|
||
| 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 | ||
|
|
||
|
|
||
| QWEN35_FP8_MODEL_PATH = os.environ.get( | ||
| "QWEN35_FP8_MODEL_PATH", "Qwen/Qwen3.5-397B-A17B-FP8" | ||
| ) | ||
| PROFILE_DIR = "performance_profiles_qwen35_fp8" | ||
|
|
||
|
|
||
| class TestNightlyQwen35Fp8Performance(unittest.TestCase): | ||
| """Nightly performance benchmark for Qwen3.5-397B-A17B FP8. | ||
|
|
||
| Tests Qwen3.5 FP8 with triton attention backend on TP=8. | ||
| Runtime: ~90 minutes | ||
| """ | ||
|
|
||
| @classmethod | ||
| def setUpClass(cls): | ||
| 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")) | ||
|
|
||
| cls.model_config = { | ||
| "name": "qwen35-fp8", | ||
| "model_path": QWEN35_FP8_MODEL_PATH, | ||
| "other_args": [ | ||
| "--trust-remote-code", | ||
| "--tp", | ||
| "8", | ||
| "--attention-backend", | ||
| "aiter", | ||
| "--mem-fraction-static", | ||
| "0.8", | ||
| "--model-loader-extra-config", | ||
| '{"enable_multithread_load": true}', | ||
| "--watchdog-timeout", | ||
| "1200", | ||
| ], | ||
| "env_vars": { | ||
| "SGLANG_USE_AITER": "1", | ||
| }, | ||
| } | ||
|
|
||
| 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_qwen35_fp8(self): | ||
| """Run benchmark for Qwen3.5-397B-A17B FP8.""" | ||
| old_env = {} | ||
| for key, value in self.model_config.get("env_vars", {}).items(): | ||
| old_env[key] = os.environ.get(key) | ||
| os.environ[key] = value | ||
|
|
||
| try: | ||
| result_tuple = self.runner.run_benchmark_for_model( | ||
| model_path=self.model_config["model_path"], | ||
| batch_sizes=self.batch_sizes, | ||
| input_lens=self.input_lens, | ||
| output_lens=self.output_lens, | ||
| other_args=self.model_config["other_args"], | ||
| variant=self.model_config["name"], | ||
| extra_bench_args=["--trust-remote-code"], | ||
| enable_profile=False, | ||
| timeout=5400, | ||
| ) | ||
| results = result_tuple[0] | ||
| success = result_tuple[1] | ||
|
|
||
| if results: | ||
| self.runner.full_report += ( | ||
| generate_simple_markdown_report(results) + "\n" | ||
| ) | ||
|
|
||
| self.assertTrue(success, f"Benchmark failed for {QWEN35_FP8_MODEL_PATH}") | ||
| finally: | ||
| for key, value in old_env.items(): | ||
| if value is None: | ||
| os.environ.pop(key, None) | ||
| else: | ||
| os.environ[key] = value | ||
| self.runner.write_final_report() | ||
|
michaelzhang-ai marked this conversation as resolved.
|
||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| unittest.main() | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The calculation for
itlcould lead to aZeroDivisionErrorifresult.output_throughputis zero. It's safer to check for this case to prevent the test from crashing during report generation. Rewriting the expression also improves readability.