Skip to content

Make debug build possible on Windows with HIP backend.#20655

Open
Exile333 wants to merge 2 commits intoggml-org:masterfrom
Exile333:ggml_hip_win_fix_debug_build
Open

Make debug build possible on Windows with HIP backend.#20655
Exile333 wants to merge 2 commits intoggml-org:masterfrom
Exile333:ggml_hip_win_fix_debug_build

Conversation

@Exile333
Copy link
Contributor

@Exile333 Exile333 commented Mar 16, 2026

What is it?

Debug build for HIP backend fails on Windows. It is known problem (see ROCm/ROCm#5826) and was previously fixed for Linux build. However, CMakeFiles.txt on Windows treat HIP files as CXX files, therefore one should provide extra treatment for Windows build.

Fix is to explicitly set "-O2" option for HIP source files at Windows debug build.

If this correction is good enough to be accepted, I will also make PRs for ggml and whisper.cpp repos.

Ways to test and reproduce.

I found this issue while trying to build llama.cpp for Strix Halo (architecture gfx1151). Most likely this error occurs not only on Strix Halo and can be reproduced at any RDNA 2/3/4 AMD GPU.

git clone https://github.com/ggml-org/llama.cpp.git
cd llama.cpp
cmake -G Ninja -B build -DGGML_HIP=ON -DGGML_HIP_ROCWMMA_FATTN=OFF -DGGML_OPENMP=OFF -DAMDGPU_TARGETS=gfx1151 -DCMAKE_RC_COMPILER="C:/Program Files (x86)/Windows Kits/10/bin/10.0.26100.0/x64/rc.exe" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=Debug -DCURL_LIBRARY=C:/vcpkg_github/vcpkg/installed/x64-windows/lib/libcurl.lib -DCURL_INCLUDE_DIR=C:/vcpkg_github/vcpkg/installed/x64-windows/include
cmake --build build

Additional tests.

Not needed, current ones are good.

@github-actions github-actions bot added the ggml changes relating to the ggml tensor library for machine learning label Mar 16, 2026
@IMbackK
Copy link
Collaborator

IMbackK commented Mar 17, 2026

Just use CMAKE_CXX_FLAGS_DEBUG and get rid of the debug conditional.

EDIT: never mind we dont want the other CXX sources compiled with optimization turned on.

Copy link
Collaborator

@IMbackK IMbackK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of ugly but i think that yeah this is the only way to only compile the hip sources with optimization turned on in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ggml changes relating to the ggml tensor library for machine learning

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants