Skip to content

Commit 3303cfb

Browse files
authored
[Bugfix][Hardware][RISC-V] Limit supported dtypes to float32 to avoid scheduler segfault (#26228)
Signed-off-by: lyd1992 <[email protected]> Signed-off-by: ihb2032 <[email protected]>
1 parent b7e8e4e commit 3303cfb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

vllm/platforms/cpu.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,31 @@ def supported_dtypes(self) -> list[torch.dtype]:
8484
shell=True).strip() == b"1"):
8585
return [torch.bfloat16, torch.float16, torch.float32]
8686
return [torch.float16, torch.float32]
87+
elif self.get_cpu_architecture() == CpuArchEnum.RISCV:
88+
# Workaround for Issue #25655: RISC-V scheduler bug with float16
89+
#
90+
# Background:
91+
# - RISC-V currently uses scalar code path
92+
# - There is a latent bug in the vLLM scheduler that provides
93+
# invalid
94+
# physical_block_idx values under certain conditions
95+
# - This bug causes segmentation faults when using float16
96+
# dtype on RISC-V
97+
# - Testing shows that forcing float32 successfully bypasses
98+
# this issue
99+
#
100+
# Technical details:
101+
# - The bug manifests as out-of-bounds physical_block_idx in
102+
# block_tables
103+
# - Only occurs on RISC-V hardware
104+
# tested on Sophgo SG2044
105+
# - Does not reproduce on x86 or other architectures
106+
# - Root cause is in Python-level scheduling logic,
107+
# not C++ kernels
108+
#
109+
# This is a temporary workaround until the scheduler bug is fixed.
110+
# See: https://github.com/vllm-project/vllm/issues/25655
111+
return [torch.float32]
87112
# x86/aarch64 CPU has supported both bf16 and fp16 natively.
88113
return [torch.bfloat16, torch.float16, torch.float32]
89114

0 commit comments

Comments
 (0)