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
_load_shared_autotune_cache(cache_path, tuner, tune_group)
¶
Load the per-rank autotune cache into the tuner, group-wide.
Returns True only when every rank of the tune group had a matching file and loaded it: the dummy-run sweep contains collectives, so skipping it is safe only if the decision is unanimous.
Source code in vllm/model_executor/warmup/kernel_warmup.py
flashinfer_autotune(runner, *, skip_attn=False)
¶
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.
Parameters:
-
(runner¶GPUModelRunner) –The model runner to tune.
-
(skip_attn¶bool, default:False) –Additionally skip attention in the tuning dummy runs.
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.
Legacy 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
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 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 | |