vllm.platforms.rocm_device_memory
¶
Free device memory corrected by amdgpu's exact VRAM count.
hipMemGetInfo counts each allocation as at least 2 MB, so small allocations hide free memory; amdgpu's sysfs mem_info_vram_used counts exact sizes.
Functions:
-
exact_free_memory–Free bytes by the exact VRAM count, or None where there is none.
-
find_vram_used_file–The mem_info_vram_used file of the GPU with this torch UUID and PCI
_kfd_gpu_nodes(nodes_dir)
¶
Properties of the KFD GPU nodes; CPU and malformed nodes are skipped.
Source code in vllm/platforms/rocm_device_memory.py
_vram_used_file(index)
¶
Only unpartitioned discrete GPUs whose VRAM total matches HIP's.
Source code in vllm/platforms/rocm_device_memory.py
exact_free_memory(device=None)
¶
Free bytes by the exact VRAM count, or None where there is none.
At least free memory as HIP reports it, plus what that hides: the total less the exact count less HIP's free memory, sampled until it stops rising. An erase still pending afterwards only makes the result smaller. Other processes' allocations lower both counts alike. The exact count leaves out KFD's page-table reserve and RAS pages (about 80 MB on an R9700), which KV_CACHE_MARGIN_FLOOR_BYTES covers.
Source code in vllm/platforms/rocm_device_memory.py
find_vram_used_file(uuid, pci, total_memory, *, nodes_dir=KFD_TOPOLOGY_NODES, drm_dir=DRM_SYSFS)
¶
The mem_info_vram_used file of the GPU with this torch UUID and PCI address, and hipMemGetInfo's total_memory; or None and why not.