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 5, 09:45 UTC
Fix NUMA binding on non-CDMM Grace-Blackwell systems (#39361)
Signed-off-by: Qidong Su <soodoshll@gmail.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Qidong Su committed
Apr 9, 2026 at 03:36 UTC
ed733802f0446ba7170dbb921ec6689016d1fa3a
1 file changed
+23
-1
vllm/platforms/cuda.py
+23
-1
@@ -661,7 +661,18 @@ class NvmlCudaPlatform(CudaPlatformBase):
661
handle = pynvml.nvmlDeviceGetHandleByIndex(physical_device_id)
662
663
try:
664
- return pynvml.nvmlDeviceGetNumaNodeId(handle)
664
+ numa_node = pynvml.nvmlDeviceGetNumaNodeId(handle)
665
+ if cls._numa_node_has_cpus(numa_node):
666
+ return numa_node
667
+ # On non-CDMM Grace-Blackwell systems (e.g. GB200), each GPU's HBM
668
+ # is a separate NUMA node with no CPUs. Fall through to
669
+ # CPU-affinity-based detection to find the nearest CPU node.
670
+ logger.debug(
671
+ "NUMA node %d for GPU %d has no CPUs (non-CDMM topology), "
672
+ "falling back to CPU-affinity-based detection",
673
+ numa_node,
674
+ device_id,
675
+ )
676
except Exception:
677
pass
678
@@ -681,6 +692,17 @@ class NvmlCudaPlatform(CudaPlatformBase):
692
693
return None
694
695
+ @classmethod
696
+ def _numa_node_has_cpus(cls, node_id: int) -> bool:
697
+ """Check whether a NUMA node has any CPUs assigned to it."""
698
+ from pathlib import Path
699
+
700
+ cpulist_file = Path(f"/sys/devices/system/node/node{node_id}/cpulist")
701
+ try:
702
+ return cpulist_file.read_text().strip() != ""
703
+ except (OSError, ValueError):
704
+ return False
705
+
706
@classmethod
707
def _get_device_cpu_affinity(cls, handle) -> list[int]:
708
"""Get the list of CPU IDs associated with a GPU via NVML."""