From c4dd8e0e6142cd5cd8c8e03d943f345aa8fcb228 Mon Sep 17 00:00:00 2001 From: pi-mosaic Date: Mon, 9 Nov 2026 21:05:52 -0400 Subject: [PATCH] hrx: log the status when the HRX runtime fails to initialise (engine #1766) create_registry_context() discarded a failed hrx_gpu_initialize() with hrx_status_ignore() and returned an empty context, where every other HRX call in the file goes through hrx_check(). The runtime failure then surfaced only as its absence: `llama-bench --list-devices` printed "(none)", and `--device HRX0` was rejected as "error: invalid device: HRX0" -- a complaint about the CLI argument rather than about a runtime that never initialised. The status now goes through hrx_check(), so the line has the same file:line:expression prefix as every other HRX failure, and a second line names the downstream symptoms so the next reader connects them to this one. The return is unchanged: a failed init still leaves the device list empty, and llama.cpp's own wording for a bad --device stays the CLI's business. The case that produced this (this box, engine pin c8c518cb4): a distro ROCr whose libhsa-runtime64.so.1 does not export hsa_amd_queue_create, which the new line names by symbol; pointing IREE_HAL_AMDGPU_LIBHSA_PATH and LD_LIBRARY_PATH at the therock build is what made the same build see one device. Verified: g++ -std=c++20 -fsyntax-only on the translation unit with the tree's includes plus libhrx/include -- clean. Not verified: a built binary emitting the line, which needs a full HRX build; the branch is reachable only for a status that is neither OK nor ALREADY_EXISTS. --- ggml/src/ggml-hrx/ggml-hrx.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-hrx/ggml-hrx.cpp b/ggml/src/ggml-hrx/ggml-hrx.cpp index 5f01aa3002e6..63881f3c4df8 100644 --- a/ggml/src/ggml-hrx/ggml-hrx.cpp +++ b/ggml/src/ggml-hrx/ggml-hrx.cpp @@ -1590,7 +1590,16 @@ static std::unique_ptr create_registry_context() { } else if (hrx_status_code(status) == HRX_STATUS_ALREADY_EXISTS) { hrx_status_ignore(status); } else { - hrx_status_ignore(status); + // NOT silent (engine #1766): a failed init registers zero devices, and then every downstream symptom points at + // something else -- `llama-bench --list-devices` prints "(none)", and `--device HRX0` is rejected as "invalid + // device: HRX0", a complaint about the CLI argument rather than about a runtime that never initialised. The + // status goes through hrx_check() so the line reads like every other HRX failure in this file (same + // file:line:expression prefix, same status consumption); the first attempt found the cause to be a ROCr whose + // libhsa-runtime64 does not export hsa_amd_queue_create, which that message names by symbol. + hrx_check(status, "hrx_gpu_initialize(0)", __FILE__, __LINE__); + GGML_LOG_ERROR("ggml_hrx: the HRX runtime did not initialise, so this backend registers no devices: " + "--list-devices will print none and --device HRX0 will be rejected as an invalid device. " + "The line above is the reason (engine #1766)\n"); return context; } int count = 0;