@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 5d0fd87038
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 4, 06:15 UTC

[CPU][RISC-V] Auto-bind OMP threads and harden nobind path (#40569)

Signed-off-by: liuyudong <liuyudong@iscas.ac.cn>

lyd1992 committed May 6, 2026 at 19:38 UTC 5d0fd87038b123a11dd9c85a05ce2d258e27ce7b
1 file changed +14 -7
vllm/utils/ompmultiprocessing.py
+14 -7
@@ -40,12 +40,13 @@ class OMPProcessManager:
40
41 assert not (self.use_iomp and self.use_gomp)
42
43 - # at least reserve 1/local_world_size(for ARM) core for scheduler
43 + # at least reserve 1/local_world_size(for ARM/RISC-V) core for scheduler
44 # proc as always use MP executor
45 # TODO: make scheduler proc sleep when idle
46 self.reserve_cpu_num = (
47 self.local_world_size
48 - if current_platform.get_cpu_architecture() == CpuArchEnum.ARM
48 + if current_platform.get_cpu_architecture()
49 + in (CpuArchEnum.ARM, CpuArchEnum.RISCV)
50 else 1
51 )
52 # reserve at one more core for nixl_connector under p/d case
@@ -140,8 +141,8 @@ class OMPProcessManager:
141 cpu_list, reserve_list = self._get_autobind_cpu_ids(
142 lambda cpus: cpus[-1:]
143 )
143 - elif cpu_arch == CpuArchEnum.ARM:
144 - # For AArch64, no SMT, use all logical CPU
144 + elif cpu_arch in (CpuArchEnum.ARM, CpuArchEnum.RISCV):
145 + # For AArch64 / RISC-V, no SMT, use all logical CPUs
146 cpu_list, reserve_list = self._get_autobind_cpu_ids(lambda cpus: cpus)
147 else:
148 cpu_list, reserve_list = [], []
@@ -173,9 +174,15 @@ class OMPProcessManager:
174 # skip
175 self.cpu_lists = []
176
176 - msg = "OpenMP thread binding info: \n"
177 - for i in range(self.local_world_size):
178 - msg += f"\tlocal_rank={i}, core ids={self.cpu_lists[i]}\n"
177 + msg = (
178 + "OpenMP thread binding info: \n"
179 + f"\tVLLM_CPU_OMP_THREADS_BIND={vllm_mask!r}, "
180 + f"auto_setup={self.auto_setup}, skip_setup={self.skip_setup}\n"
181 + f"\tlocal_world_size={self.local_world_size}, "
182 + f"reserve_cpu_num={self.reserve_cpu_num}\n"
183 + )
184 + for i, cpus in enumerate(self.cpu_lists):
185 + msg += f"\tlocal_rank={i}, core ids={cpus}\n"
186 msg += f"\treserved_cpus={self.reserved_cpu_list}"
187 logger.info(msg)
188