Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions vllm/v1/worker/gpu/cudagraph_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ def __init__(
decode_query_len: int,
):
super().__init__(vllm_config, device, cudagraph_mode, decode_query_len)
# Used for FULL CUDA graphs. PW CUDA graphs do not use these.
self.hidden_states: torch.Tensor | None = None
self.aux_hidden_states: list[torch.Tensor] = []
self.use_aux_hidden_state_outputs = False
Expand Down Expand Up @@ -326,6 +327,12 @@ def forward_fn(cg_mode: CUDAGraphMode) -> None:
**model_state.prepare_dummy_inputs(num_reqs, num_tokens),
}
model_output = model(**model_inputs)

if cg_mode == CUDAGraphMode.PIECEWISE:
# PW CUDA graph internally handles the model outputs.
# No need to keep track of the hidden states.
return None

if self.use_aux_hidden_state_outputs:
hidden_states, aux_hidden_states = model_output
else:
Expand Down
Loading