Skip to content

ROCm 7.2 + 原生Ubuntu 24.04 环境下 vLLM / MinerU 存在平台初始化与 HIP toolchain 不稳定问题 #1

Description

@kuanKuAns

环境信息
OS:Ubuntu 24.04
ROCm:7.2.1
GPU:AMD(gfx1201)
Python:3.12

问题总结

在 ROCm 7.2 + Ubuntu 24.04 环境下,按照流程部署 vLLM + MinerU 时,遇到三个关键问题,分别导致:

  • 无法编译
  • GPU 误判
  • 推理阶段 EngineCore 启动失败或卡死

最终需要针对 vLLM ROCm backend 做补丁或环境修复才能稳定运行。

问题 1:HIP / hipcc wrapper 路径假设错误(导致无法编译)

  • 现象

CMake 阶段报错:

Can't find CUDA or HIP installation
hipcc not found
/opt/rocm/bin/hipcc -> broken symbolic link

  • 根因

原生ubuntu24.04环境可能和wsl环境中hipcc位置不同(?):
ln -sf /usr/bin/hipcc.pl /opt/rocm/bin/hipcc
但在 Ubuntu 24.04 + ROCm 7.2.1 环境中:
/usr/bin/hipcc.pl 实际不存在

正确路径是:
/opt/rocm-7.2.1/bin/hipcc

导致:
hipcc 被覆盖为错误符号链接
CMake 无法识别 HIP toolchain
vLLM 直接无法编译

  • 影响

vLLM 编译失败
ROCm toolchain 识别失败
HIP 环境看似安装但不可用

问题 2:vLLM ROCm platform detection 失败(device_type = '')

现象

vLLM 初始化时报错:
RuntimeError: Device string must not be empty

调试结果:
current_platform = UnspecifiedPlatform
device_type = ''
is_rocm = False

  • 根因(双因素)
  1. amdsmi 在环境中不可用
    ModuleNotFoundError: amdsmi

导致 ROCm 探测失败。

  1. platform 初始化 fallback 不完整

在 _get_gcn_arch() 路径中:

logger.warning_once() 会触发 vllm.distributed
distributed 再 import current_platform
形成循环导入

最终导致:

platform 初始化中途失败
current_platform 退化为 UnspecifiedPlatform

  • 影响

GPU 被误判为不可用
device_type = ''
EngineCore 无法启动

  • 本质问题

vLLM ROCm platform detection 在“无 amdsmi 或初始化失败”时:

fallback 路径不可靠
会导致 silent failure(没有 GPU,但也不报明确错误)

问题 3:vLLM platform import cycle(循环导入崩溃)

  • 现象

错误包括:
ImportError: cannot import name 'current_platform'

或:
EngineCore 启动失败
multiprocessing spawn 失败
子进程初始化中断

  • 根因

import chain:
rocm.py
→ logger.warning_once()
→ vllm.distributed.parallel_state
→ vllm.platforms.current_platform
→ rocm.py(再次触发)

形成循环依赖:
vllm.platforms ↔ vllm.distributed

  • 影响

EngineCore 初始化失败
子进程无法启动
推理流程随机崩溃或卡死

  • 本质问题

平台检测逻辑与 distributed logging / runtime 绑定过深,导致:
platform init 不再是纯函数逻辑
在 multiprocessing 场景下不稳定

  • 结果表现(综合)

在修复上述问题之前,整体表现为:
vLLM 可以编译,但 runtime 不稳定
GPU 识别随机失败
EngineCore 初始化失败
multiprocessing spawn error
inference 卡在 loading / 12/12
或 GPU 100% 但无输出

最终状态

在修复:
HIP wrapper 路径
ROCm platform fallback
warning_once 导致的循环导入问题

之后:
vLLM 正常识别 ROCm GPU
EngineCore 正常启动
inference 正常完成
MinerU pipeline 跑通

↑第一次写issue让gpt写的,如有问题见谅↑

纯小白全靠gemini和gpt的vibecoding
正好27号在装minerU想搞论文清洗按gemini给的办法走了一遍完全用不了
正好看到项目就想试试,感谢社区各位大佬,给了像我这种小白amd用户有更多机会折腾

————————
第一次先按教程和gemini问bug走了一遍,gemini也发现了hipcc位置不一样的问题让我改了
7.7 ninja 编译的地方卡了两次,让我改了点东西之后通过了,7.10 验证 vllm也成功出现RocmPlatform / True / cuda(应该就是这里出了问题)
后来一路装过去直到最后测试的时候**RuntimeError: Engine core initialization failed.**才知道前面有问题,免费的gemini还是不够聪明所以转去问gpt()

一路排除问题后确认是vllm编译的问题,
先确定了在原生Ubuntu24.04+ROCm7.21的环境下
*7.5 补丁 5:vllm mamba operator+ 冲突
这个补丁是不用打的,推测是vllm更新了()

后来碰到了

**current_platform.device_type

空字符串**
导致
RuntimeError:Device string must not be empty

和后面的循环,
就把补丁 A:~/vllm/vllm/platforms/init.py补丁 B:~/vllm/vllm/platforms/rocm.py打上了。
后面就按流程一路跑通了(除了我自己网太卡折腾半天)

再次感谢各位社区大佬

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions