Skip to content

Commit df23f75

Browse files
HIP: fix AMDGPU_TARGETS, update documentation
1 parent 945501f commit df23f75

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

docs/build.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ You can download it from your Linux distro's package manager or from here: [ROCm
261261
- Using `CMake` for Linux (assuming a gfx1030-compatible AMD GPU):
262262
```bash
263263
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -R)" \
264-
cmake -S . -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1030 -DCMAKE_BUILD_TYPE=Release \
264+
cmake -S . -B build -DGGML_HIP=ON -DGPU_TARGETS=gfx1030 -DCMAKE_BUILD_TYPE=Release \
265265
&& cmake --build build --config Release -- -j 16
266266
```
267267

@@ -282,17 +282,17 @@ You can download it from your Linux distro's package manager or from here: [ROCm
282282
```bash
283283
HIPCXX="$(hipconfig -l)/clang" HIP_PATH="$(hipconfig -p)" \
284284
HIP_DEVICE_LIB_PATH=<directory-you-just-found> \
285-
cmake -S . -B build -DGGML_HIP=ON -DAMDGPU_TARGETS=gfx1030 -DCMAKE_BUILD_TYPE=Release \
285+
cmake -S . -B build -DGGML_HIP=ON -DGPU_TARGETS=gfx1030 -DCMAKE_BUILD_TYPE=Release \
286286
&& cmake --build build -- -j 16
287287
```
288288

289289
- Using `CMake` for Windows (using x64 Native Tools Command Prompt for VS, and assuming a gfx1100-compatible AMD GPU):
290290
```bash
291291
set PATH=%HIP_PATH%\bin;%PATH%
292-
cmake -S . -B build -G Ninja -DAMDGPU_TARGETS=gfx1100 -DGGML_HIP=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release
292+
cmake -S . -B build -G Ninja -DGPU_TARGETS=gfx1100 -DGGML_HIP=ON -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Release
293293
cmake --build build
294294
```
295-
Make sure that `AMDGPU_TARGETS` is set to the GPU arch you want to compile for. The above example uses `gfx1100` that corresponds to Radeon RX 7900XTX/XT/GRE. You can find a list of targets [here](https://llvm.org/docs/AMDGPUUsage.html#processors)
295+
Make sure that `GPU_TARGETS` is set to the GPU arch you want to compile for. The above example uses `gfx1100` that corresponds to Radeon RX 7900XTX/XT/GRE. You can find a list of targets [here](https://llvm.org/docs/AMDGPUUsage.html#processors)
296296
Find your gpu version string by matching the most significant version information from `rocminfo | grep gfx | head -1 | awk '{print $2}'` with the list of processors, e.g. `gfx1035` maps to `gfx1030`.
297297

298298

ggml/src/ggml-hip/CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ if (CXX_IS_HIPCC)
2929
endif()
3030
else()
3131
# Forward (AMD)GPU_TARGETS to CMAKE_HIP_ARCHITECTURES.
32+
if(AMDGPU_TARGETS AND NOT GPU_TARGETS)
33+
set(GPU_TARGETS ${AMDGPU_TARGETS})
34+
endif()
3235
if(GPU_TARGETS AND NOT CMAKE_HIP_ARCHITECTURES)
3336
set(CMAKE_HIP_ARCHITECTURES ${GPU_TARGETS})
34-
elseif(AMDGPU_TARGETS AND NOT CMAKE_HIP_ARCHITECTURES)
35-
set(CMAKE_HIP_ARCHITECTURES ${AMDGPU_TARGETS})
3637
endif()
3738
cmake_minimum_required(VERSION 3.21)
3839
enable_language(HIP)

0 commit comments

Comments
 (0)