Skip to content

fix(build): guard CUDA driver probe out of HIP builds - #480

Merged
0xShug0 merged 1 commit into
0xShug0:mainfrom
IIIIIllllIIIIIlllll:fix/hip-attention-fallback-link
Sep 7, 2026
Merged

fix(build): guard CUDA driver probe out of HIP builds#480
0xShug0 merged 1 commit into
0xShug0:mainfrom
IIIIIllllIIIIIlllll:fix/hip-attention-fallback-link

Conversation

@IIIIIllllIIIIIlllll

@IIIIIllllIIIIIlllll IIIIIllllIIIIIlllll commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

I haven't updated the program for a while. Today when I pulled the latest branch and compiled with ROCm, I got an error. Upon investigation, I found that a recent commit caused a conflict. Here is a fix patch that bypasses the CUDA-related paths when building with HIP/ROCm.

[918/919] Linking CXX executable bin/audiocpp_server FAILED: bin/audiocpp_server : && /opt/rocm/core-7.14/lib/llvm/bin/clang++ -O2 -g -DNDEBUG -Xlinker --dependency-file=CMakeFiles/audiocpp_server.dir/link.d CMakeFiles/audiocpp_server.dir/app/common/build_info.cpp.o CMakeFiles/audiocpp_server.dir/app/server/main.cpp.o CMakeFiles/audiocpp_server.dir/app/server/base64.cpp.o CMakeFiles/audiocpp_server.dir/app/server/config.cpp.o CMakeFiles/audiocpp_server.dir/app/server/http.cpp.o CMakeFiles/audiocpp_server.dir/app/server/model_memory.cpp.o CMakeFiles/audiocpp_server.dir/app/server/multipart.cpp.o CMakeFiles/audiocpp_server.dir/app/server/runtime.cpp.o CMakeFiles/audiocpp_server.dir/app/server/ui_assets.cpp.o CMakeFiles/audiocpp_server.dir/app/cli/args.cpp.o CMakeFiles/audiocpp_server.dir/app/cli/request.cpp.o CMakeFiles/audiocpp_server.dir/app/streaming/pcm_source.cpp.o CMakeFiles/audiocpp_server.dir/app/streaming/streaming.cpp.o -o bin/audiocpp_server -Wl,-rpath,/opt/rocm/core-7.14/lib:/opt/rocm/lib:/opt/rocm/core-7.14/lib/llvm/lib libengine_runtime.a ggml/src/libggml.a -ldl ggml/src/libggml-cpu.a ggml/src/ggml-hip/libggml-hip.a ggml/src/libggml-base.a -lm /opt/rocm/core-7.14/lib/libhipblas.so.3.5 /opt/rocm/core-7.14/lib/librocblas.so.5.5 /opt/rocm/lib/libamdhip64.so.7.14.60850-0000000 /opt/rocm/core-7.14/lib/llvm/lib/clang/23/lib/linux/libclang_rt.builtins-x86_64.a /opt/rocm/lib/libhipblaslt.so.1.4 /opt/rocm/core-7.14/lib/libamdhip64.so.7.14.60850-0000000 /opt/rocm/core-7.14/lib/llvm/lib/libomp.so /lib/x86_64-linux-gnu/libpthread.a external/sentencepiece/src/libsentencepiece.a libcjson_vendor.a libyaml_vendor.a && : ld.lld: error: undefined symbol: cuDeviceGet

referenced by attention_fallback.cpp:83 (/home/mark/App/audio.cpp-hub/audiocpp/audio.cpp-main-bc75bab/audio.cpp-main/src/framework/core/attention_fallback.cpp:83) attention_fallback.cpp.o:(engine::core::resolve_flash_attention(ggml_backend*, long, engine::core::AttentionPreference)) in archive libengine_runtime.a

ld.lld: error: undefined symbol: cuDeviceGetAttribute

referenced by attention_fallback.cpp:88 (/home/mark/App/audio.cpp-hub/audiocpp/audio.cpp-main-bc75bab/audio.cpp-main/src/framework/core/attention_fallback.cpp:88) attention_fallback.cpp.o:(engine::core::resolve_flash_attention(ggml_backend*, long, engine::core::AttentionPreference)) in archive libengine_runtime.a referenced by attention_fallback.cpp:91 (/home/mark/App/audio.cpp-hub/audiocpp/audio.cpp-main-bc75bab/audio.cpp-main/src/framework/core/attention_fallback.cpp:91) attention_fallback.cpp.o:(engine::core::resolve_flash_attention(ggml_backend*, long, engine::core::AttentionPreference)) in archive libengine_runtime.a clang++: error: linker command failed with exit code 1 (use -v to see invocation) ninja: build stopped: subcommand failed.

see also: #423

AI usage: Kimi k3

ggml-hip publicly defines GGML_USE_CUDA for its consumers (hipified CUDA
sources), so attention_fallback.cpp compiled the CUDA driver API probe
(cuDeviceGet/cuDeviceGetAttribute) in HIP builds too, where no libcuda
exists to link against. Every HIP link of the runtime then fails with
undefined symbols.

Define ENGINE_GGML_HIP_BACKEND on engine_core when ENGINE_ENABLE_HIP is
on and use it to compile the probe out. HIP devices are named "ROCmN"
and were already skipped by the runtime name check, so behavior on HIP
is unchanged: the probe stays fail-open and flash attention remains
enabled.
@0xShug0
0xShug0 merged commit baf0bb8 into 0xShug0:main Sep 7, 2026
6 checks passed
@0xShug0

0xShug0 commented Sep 7, 2026

Copy link
Copy Markdown
Owner

@IIIIIllllIIIIIlllll Good catch! PR merged.

@IIIIIllllIIIIIlllll
IIIIIllllIIIIIlllll deleted the fix/hip-attention-fallback-link branch September 7, 2026 06:58
gqf2008 added a commit to gqf2008/audio.cpp that referenced this pull request Sep 7, 2026
ENGINE_BUILD_TESTS is OFF by default so CI never compiled or ran the
unittest suite. Configure with ENGINE_BUILD_TESTS=ON and run ctest after
the main targets on the three CMake-driven workflows; build_windows.ps1
gains a -RunTests switch (forces tests ON, builds remaining targets,
runs ctest) instead of hardcoding it into the release presets.

Rebased after the test-gate split (0xShug0#480-era): the noisy utility/perf
tests now live behind ENGINE_BUILD_EXTENDED_TESTS / MODEL_TESTS, so the
plain unit gate runs clean with no per-test exclusions.
0xShug0 pushed a commit that referenced this pull request Sep 7, 2026
ENGINE_BUILD_TESTS is OFF by default so CI never compiled or ran the
unittest suite. Configure with ENGINE_BUILD_TESTS=ON and run ctest after
the main targets on the three CMake-driven workflows; build_windows.ps1
gains a -RunTests switch (forces tests ON, builds remaining targets,
runs ctest) instead of hardcoding it into the release presets.

Rebased after the test-gate split (#480-era): the noisy utility/perf
tests now live behind ENGINE_BUILD_EXTENDED_TESTS / MODEL_TESTS, so the
plain unit gate runs clean with no per-test exclusions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants