From eb95ddd9ab0d178fb97fa98f8b5246e9112f0a81 Mon Sep 17 00:00:00 2001 From: bong-water-water-bong Date: Sun, 8 Nov 2026 18:46:03 -0400 Subject: [PATCH] hw-gate: pick the kernel-corpus form from the tools installed, so a box without loom-format can configure The gate configures llama.cpp with GGML_HRX=ON, and ggml-hrx's kernel corpus defaults to GGML_HRX_KERNEL_CORPUS_SOURCE_FORMAT=binary, which FATAL_ERRORs before anything is built unless loom-link and loom-format are on PATH. On strixhalo (2026-11-09) loom-link is present under ~/lb/fnpre/tools and loom-format is not on the box at all, so 'HW_GATE_PRIVATE=0' -- the mode whose whole purpose is 'a box with no read access to gpu-kernels' -- could not configure, and the error names the Loom assembler rather than the flag. The form is now chosen from what is installed: binary when both tools are on PATH (a release box has them, so releases are unchanged), text otherwise, and HW_GATE_CORPUS_FORMAT forces either (a forced binary without the tools is a named error, not a configure failure deep in a build log). Measured on the same checkout, same flags: without the flag: 'GGML_HRX_KERNEL_CORPUS_SOURCE_FORMAT=binary requires loom-link and loom-format' -> Configuring incomplete with =text: Configuring done (1.2 s) Refs engine#1517, whose baseline is missing because 'the op-level harness does not exist in any shipped artifact' -- this is the step that makes test-backend-ops buildable on a box that is not a release box. --- scripts/hw-gate.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/scripts/hw-gate.sh b/scripts/hw-gate.sh index 3a8c043c9..e3cc87f0c 100755 --- a/scripts/hw-gate.sh +++ b/scripts/hw-gate.sh @@ -422,6 +422,26 @@ if [ -z "$BIN" ]; then hip_flags="-O3" [ -n "$device_lib" ] && hip_flags="-O3 --rocm-device-lib-path=$device_lib" export HIP_DEVICE_LIB_PATH=${HIP_DEVICE_LIB_PATH:-$device_lib} + # The kernel corpus is embedded in one of two forms (ggml/src/ggml-hrx/CMakeLists.txt): `binary`, + # the default, is what a release ships and needs the Loom assembler (`loom-link` and `loom-format` + # on PATH); `text` embeds the .loom sources and needs neither. A box without the Loom tools cannot + # configure the default at all -- it stops at "requires loom-link and loom-format" before anything + # is built -- which is what the gate hit on strixhalo (2026-11-09): loom-link is present under + # ~/lb/fnpre/tools and loom-format is not on the box. So pick the form from what is installed and + # say which one, rather than failing where the message looks like a broken checkout. A release + # still builds `binary` because a release box has the tools; HW_GATE_CORPUS_FORMAT forces either. + corpus=${HW_GATE_CORPUS_FORMAT:-} + if [ -z "$corpus" ]; then + if command -v loom-link > /dev/null 2>&1 && command -v loom-format > /dev/null 2>&1; then corpus=binary + else corpus=text; fi + fi + case "$corpus" in + binary) command -v loom-link > /dev/null 2>&1 && command -v loom-format > /dev/null 2>&1 || { + note "::error::HW_GATE_CORPUS_FORMAT=binary needs loom-link and loom-format on PATH"; exit 2; } ;; + text) ;; + *) note "::error::HW_GATE_CORPUS_FORMAT=$corpus is neither binary nor text"; exit 2 ;; + esac + note "kernel corpus: $corpus${corpus:+}" # a changed flag set must not be read from an existing cache [ "$(cat "$build/.hip-flags" 2>/dev/null)" = "$hip_flags" ] || rm -f "$build/CMakeCache.txt" # the same configuration as cmake/hrx.cmake (llama_hrx), plus the two test tools @@ -435,6 +455,7 @@ if [ -z "$BIN" ]; then -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DHRX_SOURCE_DIR="$ROOT/third_party/hrx-system" "${addon_args[@]}" \ -DGGML_HRX=ON -DGGML_VULKAN=OFF -DGGML_CUDA=OFF -DGGML_HIP=OFF -DGGML_NATIVE=ON -DGGML_CPU=ON \ + -DGGML_HRX_KERNEL_CORPUS_SOURCE_FORMAT="$corpus" \ -DGGML_HRX_HIP_COMPILER="$TOOLCHAIN/bin/amdclang++" "-DGGML_HRX_HIP_FLAGS=$hip_flags" \ -DLLAMA_BUILD_SERVER=ON -DLLAMA_BUILD_TESTS=ON -DLLAMA_CURL=OFF >> "$OUT/build.log" 2>&1 && echo "$addon_pin" > "$build/.gpu-kernels-pin" && echo "$hip_flags" > "$build/.hip-flags"; }; } &&