问题 / #446

#446 setup (--backend hip): a runtime-only system ROCm 7 in /opt/rocm is picked for the engine build, and cmake fails on the missing hip-lang package instead of falling back to the TheRock wheels

closed · @harurun78 · 1 评论 · 去 GitHub 看

Setup & installAMD / HIPModels & quantsWindowsLinux

说明

### What happens

`./setup.sh --backend hip` on a PC whose `/opt/rocm` has the ROCm 7.14 runtime packages but not the development ones stops in step 4:

```
  The ROCm root directory:

   /opt/rocm

  does not contain the HIP runtime CMake package, expected at one of:

   /opt/rocm/lib/cmake/hip-lang/hip-lang-config.cmake
   /opt/rocm/lib64/cmake/hip-lang/hip-lang-config.cmake
   /opt/rocm/lib/x86_64-unknown-linux-gnu/cmake/hip-lang/hip-lang-config.cmake

Call Stack (most recent call first):
  cmake/hip_backend.cmake:38 (enable_language)
  CMakeLists.txt:50 (include)

-- Configuring incomplete, errors occurred!

  [X]  command failed (exit 1): cmake
```

### Why

`rocm_root()` in setup.py takes the system ROCm when `bin/hipcc` and `lib/libhipblas.so*` exist and the version is 7.0 or newer. A runtime-only install has both, so the check passes:

- `/opt/rocm/bin/hipcc` exists (on this install it comes from `amdrocm-llvm7.14`)
- `/opt/rocm/lib/libhipblas.so*` and `libamdhip64.so*` exist
- `include/rocm-core/rocm_version.h` says 7.14

The parts the build needs are missing, though: `lib/cmake/hip-lang/`, `lib/cmake/hip/` and `include/hip/hip_runtime.h`. On AMD's 26.13 repo the HIP ones ship in `amdrocm-runtime-dev7.14` (checked with `dpkg -c`), which, like `amdrocm-blas-dev7.14`, comes with `amdrocm-core-dev7.14-gfx1201`; none of the `-dev` packages are installed here. So setup never tries the TheRock wheels path, which works on this PC without sudo.

### Workaround

Point `ROCM_PATH` somewhere without ROCm, so setup takes the TheRock wheels path:

```sh
ROCM_PATH=$HOME/.no-system-rocm ./setup.sh --backend hip
```

With that, the setup ran to the end (ROCm 7.10.0a20251120 wheels from `gfx120X-all`, engine compiled, IQ3_XXS ready), and the server answers normally, tool calls included.

### Suggested fix

Have the system-ROCm check also look for the files the build needs (for example `lib/cmake/hip-lang/hip-lang-config.cmake` and `include/hip/hip_runtime.h`). When they are missing, warn and use the wheels, the same way an older ROCm is handled now:

```
[!] the ROCm in /opt/rocm has no HIP development files (lib/cmake/hip-lang): using AMD's wheels in .venv instead
    (or install them, e.g. sudo apt install amdrocm-core-dev7.14-gfx1201)
```

(I have not tried the build with the `-dev` packages installed; the wheels path is the one verified here.)

Note: open PR #426 (Windows AMD) also changes `rocm_root()`, so this fix may be easier on top of it.

### Environment

- Strata `main` @ aeb35be (the code in question is the same on 1678de3)
- Ubuntu 24.04.5, kernel 7.0.0-31-generic
- AMD Radeon RX 9070 XT 16 GB (gfx1201), Ryzen 9 3950X, 63 GB RAM
- amdgpu-install 31.40 + AMD's repo `rocmradeon/apt/26.13`: `amdrocm-*7.14` 7.14.0~pre3 runtime packages (`amdrocm-core7.14-gfx1201`, `amdrocm-blas7.14-gfx1201`, `amdrocm-llvm7.14`, ...), no `-dev` packages
- Command: `./setup.sh --backend hip --yes --no-start`

本站相关内容

相关页面的快捷入口。