vllm.model_executor.warmup.kernel_warmup
¶
Warmup kernels used during model execution. This is useful specifically for JIT'ed kernels as we don't want JIT'ing to happen during model execution.
Functions:
-
flashinfer_autotune–Autotune FlashInfer operations.
_all_ranks_have_matching_cache(path, group)
¶
True iff every rank in group has its own, mutually consistent file.
Source code in vllm/model_executor/warmup/kernel_warmup.py
_autotune_cache_fingerprint(path)
¶
Identify a saved autotune file by its FlashInfer metadata and size.
Source code in vllm/model_executor/warmup/kernel_warmup.py
_flashinfer_deferred_moe_token_counts(runner)
¶
Return bounded token counts that exercise deferred MoE finalization.
Source code in vllm/model_executor/warmup/kernel_warmup.py
flashinfer_autotune(runner)
¶
Autotune FlashInfer operations. FlashInfer have many implementations for the same operation, autotuning runs benchmarks for each implementation and stores the results. The results are cached transparently and future calls to FlashInfer will use the best implementation. Without autotuning, FlashInfer will rely on heuristics, which may be significantly slower.
With PP > 1, stages run different layers and may profile different ops, so each stage's TP group tunes separately with its own cache file; otherwise the world group tunes together. Per-tactic timings are averaged over the tuning group so all its ranks select the same tactic.
Results are persisted per rank: FlashInfer keys MoE entries by tp/ep rank
(MoERunner.get_cache_key_extras), so one rank's file only hits on that
rank. A rank with a cache hit skips the per-tactic reduce the others block
in, so ranks keep loaded configs only if every rank in the tuning group
has a matching file and successfully loads it.
Source code in vllm/model_executor/warmup/kernel_warmup.py
409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 | |