llama.cpp b9780 patches Vulkan shader build to catch silent failures
Broken Vulkan builds now fail at compile time, not runtime.
llama.cpp, the popular open-source library for running LLMs locally, pushed release b9780 with a vital fix for its Vulkan backend. The bug allowed shader compilation subprocess failures to go undetected: execute_command() discarded the child exit code (on POSIX, waitpid passed nullptr; on Windows, GetExitCodeProcess was never called), and the string_to_spv function only checked if stderr was empty. This meant a non-zero exit with empty stderr or a failed subprocess launch was treated as success, silently producing a broken libggml-vulkan that would only fail at runtime.
The fix, authored by liminfei-amd (AMD), addresses this by returning the child exit code from execute_command() (WEXITSTATUS on POSIX, GetExitCodeProcess on Windows). Now, a non-zero exit, non-empty stderr, or a launch exception causes the build to set an atomic flag. The main function checks this flag after process_shaders() and returns EXIT_FAILURE before writing output files, stopping the build instead of emitting a broken backend. The commit also simplifies compile_failed access. This ensures developers using llama.cpp with Vulkan can trust their builds, preventing cryptic runtime crashes.
- Previously, Vulkan shader subprocess failures (non-zero exit, empty stderr) were treated as success, creating a broken libggml-vulkan.
- The fix makes execute_command() return child exit codes and checks for non-zero exits or non-empty stderr, setting an atomic failure flag.
- Build now exits with EXIT_FAILURE before writing output files if any shader fails to compile, preventing silent corruption.
Why It Matters
Reliable Vulkan builds mean fewer mysterious runtime crashes for local LLM users and GPU backend developers.