@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 68dfe28eae
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 12, 16:00 UTC

[Feature][Benchmark] add --link-vars can filter when serve_param equal bench_param (#28909)

Signed-off-by: rongfu.leng <rongfu.leng@daocloud.io>

rongfu.leng committed Nov 24, 2025 at 18:02 UTC 68dfe28eaefc20ce8d847c3b3ccf712716d20c20
1 file changed +33 -1
vllm/benchmarks/sweep/serve.py
+33 -1
@@ -211,6 +211,7 @@ def run_combs(
211 output_dir: Path,
212 num_runs: int,
213 dry_run: bool,
214 + links: list[tuple[str, str]],
215 ):
216 all_data = list[dict[str, object]]()
217 for serve_comb in serve_params:
@@ -226,6 +227,14 @@ def run_combs(
227 else contextlib.nullcontext()
228 ) as server:
229 for bench_comb in bench_params:
230 + should_run = all(
231 + serve_key in serve_comb
232 + and bench_key in bench_comb
233 + and serve_comb[serve_key] == bench_comb[bench_key]
234 + for serve_key, bench_key in links
235 + )
236 + if not should_run:
237 + continue
238 base_path = _get_comb_base_path(output_dir, serve_comb, bench_comb)
239
240 comb_data = run_comb(
@@ -262,6 +271,7 @@ class SweepServeArgs:
271 num_runs: int
272 dry_run: bool
273 resume: str | None
274 + link_vars: list[tuple[str, str]] | None
275
276 parser_name: ClassVar[str] = "serve"
277 parser_help: ClassVar[str] = "Run vLLM server benchmark under multiple settings."
@@ -285,7 +295,7 @@ class SweepServeArgs:
295 else:
296 # i.e.: run bench_cmd without any modification
297 bench_params = ParameterSweep.from_records([{}])
288 -
298 + link_vars = cls.parse_link_vars(args.link_vars)
299 num_runs = args.num_runs
300 if num_runs < 1:
301 raise ValueError("`num_runs` should be at least 1.")
@@ -301,6 +311,7 @@ class SweepServeArgs:
311 num_runs=num_runs,
312 dry_run=args.dry_run,
313 resume=args.resume,
314 + link_vars=link_vars,
315 )
316
317 @classmethod
@@ -376,8 +387,28 @@ class SweepServeArgs:
387 "parameter combinations for which there are still no output files.",
388 )
389
390 + parser.add_argument(
391 + "--link-vars",
392 + type=str,
393 + default="",
394 + help=(
395 + "Comma-separated list of linked variables between serve and bench, "
396 + "e.g. max_num_seqs=max_concurrency,max_model_len=random_input_len"
397 + ),
398 + )
399 +
400 return parser
401
402 + @staticmethod
403 + def parse_link_vars(s: str) -> list[tuple[str, str]]:
404 + if not s:
405 + return []
406 + pairs = []
407 + for item in s.split(","):
408 + a, b = item.split("=")
409 + pairs.append((a.strip(), b.strip()))
410 + return pairs
411 +
412
413 def run_main(args: SweepServeArgs):
414 timestamp = args.resume or datetime.now().strftime("%Y%m%d_%H%M%S")
@@ -397,6 +428,7 @@ def run_main(args: SweepServeArgs):
428 output_dir=output_dir,
429 num_runs=args.num_runs,
430 dry_run=args.dry_run,
431 + links=args.link_vars,
432 )
433 except BaseException as exc:
434 raise RuntimeError(