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 11, 15:00 UTC
[CPU][FIX] Fix build failures on Arm CPUs with torch nightly (#30481)
Signed-off-by: Fadi Arafeh <fadi.arafeh@arm.com>
Fadi Arafeh committed
Dec 12, 2025 at 02:09 UTC
f355ad5412bc414a2a55f55481cb4aa1d909b4a3
2 files changed
+24
-13
cmake/utils.cmake
+14
-9
@@ -140,16 +140,21 @@ function(vllm_prepare_torch_gomp_shim TORCH_GOMP_SHIM_DIR)
140
run_python(_VLLM_TORCH_GOMP_PATH
141
"
142
import os, glob
143
-try:
144
- import torch
145
- torch_pkg = os.path.dirname(torch.__file__)
146
- site_root = os.path.dirname(torch_pkg)
147
- torch_libs = os.path.join(site_root, 'torch.libs')
148
- print(glob.glob(os.path.join(torch_libs, 'libgomp-*.so*'))[0])
149
-except:
150
- print('')
143
+import torch
144
+torch_pkg = os.path.dirname(torch.__file__)
145
+site_root = os.path.dirname(torch_pkg)
146
+
147
+# Search both torch.libs and torch/lib
148
+roots = [os.path.join(site_root, 'torch.libs'), os.path.join(torch_pkg, 'lib')]
149
+candidates = []
150
+for root in roots:
151
+ if not os.path.isdir(root):
152
+ continue
153
+ candidates.extend(glob.glob(os.path.join(root, 'libgomp*.so*')))
154
+
155
+print(candidates[0] if candidates else '')
156
"
152
- "failed to probe torch.libs for libgomp")
157
+ "failed to probe for libgomp")
158
159
if(_VLLM_TORCH_GOMP_PATH STREQUAL "" OR NOT EXISTS "${_VLLM_TORCH_GOMP_PATH}")
160
return()
vllm/platforms/cpu.py
+10
-4
@@ -325,10 +325,16 @@ class CpuPlatform(Platform):
325
# We need to find the location of PyTorch's libgomp
326
torch_pkg = os.path.dirname(torch.__file__)
327
site_root = os.path.dirname(torch_pkg)
328
- torch_libs = os.path.join(site_root, "torch.libs")
329
- pytorch_libgomp_so_candidates = glob.glob(
330
- os.path.join(torch_libs, "libgomp-*.so*")
331
- )
328
+ # Search both torch.libs and torch/lib - See: https://github.com/vllm-project/vllm/issues/30470
329
+ torch_libs_paths = [
330
+ os.path.join(site_root, "torch.libs"),
331
+ os.path.join(torch_pkg, "lib"),
332
+ ]
333
+ pytorch_libgomp_so_candidates = []
334
+ for torch_libs in torch_libs_paths:
335
+ pytorch_libgomp_so_candidates.extend(
336
+ glob.glob(os.path.join(torch_libs, "libgomp*.so*"))
337
+ )
338
if pytorch_libgomp_so_candidates:
339
pytorch_libgomp_so = pytorch_libgomp_so_candidates[0]
340
if ld_preload_str: