[Bugfix][V2] Warm up kernels before capturing CUDA graphs (#55341)

Signed-off-by: aoshen02 <aoshen02@users.noreply.github.com>
Signed-off-by: Nick Hill <nickhill123@gmail.com>
Co-authored-by: aoshen02 <aoshen02@users.noreply.github.com>
Co-authored-by: Nick Hill <nickhill123@gmail.com>
This commit is contained in:
aoshen02
2026-09-04 22:44:18 +00:00
committed by GitHub
co-authored by aoshen02 Nick Hill
parent 8f269a93bb
commit 685074cd61
7 changed files with 129 additions and 16 deletions
+5 -4
View File
@@ -790,6 +790,10 @@ class Worker(WorkerBase):
# cuda graph capture.
kernel_warmup(self)
if self.use_v2_model_runner:
# A workspace resize after capture frees what the graphs point at.
warmup_kernels(self.model_runner, self.execute_model, self.sample_tokens)
cuda_graph_memory_bytes = 0
if not self.model_config.enforce_eager:
cuda_graph_memory_bytes = self.model_runner.capture_model()
@@ -868,10 +872,7 @@ class Worker(WorkerBase):
maybe_save_startup_plan(self, kv_cache_memory_bytes_to_requested_limit)
if self.use_v2_model_runner:
# V2: Run full execute_model + sample_tokens to JIT compile triton kernels.
warmup_kernels(self.model_runner, self.execute_model, self.sample_tokens)
elif get_pp_group().is_last_rank:
if not self.use_v2_model_runner and get_pp_group().is_last_rank:
# V1: Warm up sampler and preallocate memory buffer for logits and other
# sampling related tensors of max possible shape to avoid memory
# fragmentation issue.