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
2 changes: 2 additions & 0 deletions vllm/platforms/xpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def check_and_update_config(cls, vllm_config: VllmConfig) -> None:
# lazy import to avoid circular import
from vllm.config import CompilationLevel, CUDAGraphMode
compilation_config = vllm_config.compilation_config
if compilation_config.compile_sizes is None:
compilation_config.compile_sizes = []
Comment on lines +116 to +117
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This change correctly handles the case where compile_sizes is None. However, it is incomplete and can lead to a runtime error in other scenarios.

Specifically, if a user configures compile_sizes with the special value "cudagraph_capture_sizes", this if condition will not be met, and the special string will not be expanded. This will cause a TypeError later when the code attempts to iterate over it expecting integers.

A more robust solution is to call compilation_config.init_with_cudagraph_sizes(). This method is designed to correctly process the compile_sizes attribute from user configuration. Since XPU does not support CUDA graphs, we can pass an empty list for cudagraph_capture_sizes.

        # `init_with_cudagraph_sizes` is not called on platforms without static
        # graph support. We call it here to ensure `compile_sizes` is
        # correctly initialized from user config.
        compilation_config.init_with_cudagraph_sizes(cudagraph_capture_sizes=[])


assert compilation_config.cudagraph_mode == CUDAGraphMode.NONE, \
"CUDA graph mode should be NONE on XPU"
Expand Down