执行摘要
在 XPU 平台添加 empty_cache 调用以对齐 CUDA 内存分析,但测量逻辑可能不正确。
根据PR body,动机是"cuda platform add empty_cache for get_current_memory_usage in https://github.com/vllm-project/vllm/issues/19033 xpu/rocm platform should add this to keep memory profiling part align with cuda.",即为了对齐CUDA平台的内存使用分析,XPU和ROCm平台需要添加empty_cache调用。
建议关注此PR中未解决的逻辑问题,后续可能需要修复测量逻辑以真正对齐CUDA。对于技术管理者,值得检查是否有相关issue跟进;对于工程师,可精读review讨论以了解硬件平台内存测量差异和潜在改进点。
review中,gemini-code-assist[bot]在xpu.py第253行评论指出关键问题:"The logic for get_current_memory_usage on XPU appears incorrect. Calling torch.xpu.max_memory_allocated(device) after reset_peak_memory_stats will likely return 0, not the current memory usage. To align with the ROCm and CUDA platforms, this function should use torch.xpu.mem_get_info()...",建议使用mem_get_info计算当前内存使用。然而PR未采纳此建议,仅添加了empty_cache,导致逻辑问题未解决,但两个人类reviewer(yma11和bigPYJ1151)仍批准了PR。
参与讨论