From 716f7251d0e6e53c69b8b55583dafa995a4c8b88 Mon Sep 17 00:00:00 2001 From: bcloud Date: Fri, 13 Nov 2026 09:56:00 -0400 Subject: [PATCH 1/3] hrx: refuse a q4_0 V cache at context init, because the KV write has no matcher (engine#679 item 3a) The HRX backend has no SET_ROWS matcher for a q4_0 V target, so `-ctv q4_0` dies mid-graph: graph_compute: unsupported HRX node 28: SET_ROWS output=42:q4_0[1024,2048,1,1] llama_decode: failed to decode, ret = -3 and llama-perplexity then EXITS 0 having printed no result, which any harness keyed on exit status scores as a pass. It cost a profiling run before it was diagnosed. Refuse at context init instead, next to the existing quantized-V validation, where the message can name the fix. Gated on the device name so every other backend keeps its q4_0 V support. Measured on HRX0, Qwen3-0.6B, -fa on, gpu-kernels b0ed206 add-on, at the current 1bit/hrx-vulkan-patched head 2f7f04f0d: -ctv q4_0 'the HRX backend has no q4_0 V cache support ... use -ctv q8_0 or f16' rc=1 -ctv q8_0 PPL = 98.1854 rc=0 --- src/llama-context.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/llama-context.cpp b/src/llama-context.cpp index cbd3e7330e7f..412f1f01898e 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -4146,6 +4146,25 @@ llama_context * llama_init_from_model( } } + // 1BIT / engine#679 item 3a: the HRX backend has no SET_ROWS matcher for a q4_0 V cache, so a `-ctv q4_0` run + // dies mid-compute with "unsupported HRX node 28: SET_ROWS output=...q4_0" -- and llama-perplexity then exits 0 + // having produced no output at all, which reads as a pass to any harness keyed on the exit code (measured on + // Qwen3-0.6B at gpu-kernels b0ed206, 2026-11-13). Refuse here instead, where the message can name the fix. + // Gated on the device so every other backend keeps its q4_0 V support. + if (params.type_v == GGML_TYPE_Q4_0) { + bool on_hrx = false; + for (uint32_t il = 0; il < model->hparams.n_layer() && !on_hrx; ++il) { + ggml_backend_dev_t dev = model->dev_layer(il); + const char * name = dev ? ggml_backend_dev_name(dev) : nullptr; + on_hrx = name != nullptr && std::strncmp(name, "HRX", 3) == 0; + } + if (on_hrx) { + LLAMA_LOG_ERROR("%s: the HRX backend has no q4_0 V cache support (no SET_ROWS matcher for a q4_0 " + "target, engine#679); use -ctv q8_0 or f16\n", __func__); + return nullptr; + } + } + if (params.flash_attn_type != LLAMA_FLASH_ATTN_TYPE_DISABLED && ggml_is_quantized(params.type_v)) { const uint32_t blck_size = ggml_blck_size(params.type_v); for (uint32_t il = 0; il < model->hparams.n_layer(); ++il) { From baa13e597d298c6928d1d158e4bfa14983dc947a Mon Sep 17 00:00:00 2001 From: bcloud Date: Fri, 13 Nov 2026 11:12:23 -0400 Subject: [PATCH 2/3] hrx: re-point the q4_0 refusal at the missing WRITER, and give it an expiry (engine#679 item 3a) Review caught my reason going stale, and it was right: llama.cpp#335 landed the q4_0 SET_ROWS *matcher*, so at today's head dispatch-rope-set-rows.cpp accepts (output->type != GGML_TYPE_Q8_0 && output->type != GGML_TYPE_Q4_0) || rows->type != GGML_TYPE_F32 and my message still said 'no SET_ROWS matcher for a q4_0 target'. The behaviour was right; the sentence had outlived its fact -- and a refusal that names the wrong cause is barely better than the silent exit 0 it replaced. Now it names the half that is actually missing, gpu-kernels#75 (the add-on's q4_0 writer, still open), and carries an EXPIRY: the refusal is keyed on the device while its reason is a missing kernel, so the moment #75 lands this block becomes wrong rather than early. Re-verified at the rebased head, both arms, HRX0 (0.6B): -ctv q4_0 -> 'cannot write a q4_0 V cache (no SET_ROWS writer: gpu-kernels#75, engine#679)' rc=1 -ctv q8_0 -> PPL = 98.1854 rc=0 --- src/llama-context.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/llama-context.cpp b/src/llama-context.cpp index 412f1f01898e..995cd4b1b68e 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -4146,11 +4146,14 @@ llama_context * llama_init_from_model( } } - // 1BIT / engine#679 item 3a: the HRX backend has no SET_ROWS matcher for a q4_0 V cache, so a `-ctv q4_0` run - // dies mid-compute with "unsupported HRX node 28: SET_ROWS output=...q4_0" -- and llama-perplexity then exits 0 - // having produced no output at all, which reads as a pass to any harness keyed on the exit code (measured on - // Qwen3-0.6B at gpu-kernels b0ed206, 2026-11-13). Refuse here instead, where the message can name the fix. - // Gated on the device so every other backend keeps its q4_0 V support. + // 1BIT / engine#679 item 3a: the HRX add-on has no q4_0 SET_ROWS *writer* (gpu-kernels#75, open), so a + // `-ctv q4_0` run cannot work end to end: the matcher accepts the type (llama.cpp#335) and the hook then + // declines, which surfaced as "unsupported HRX node 28: SET_ROWS output=...q4_0" mid-graph -- and + // llama-perplexity then exits 0 having produced no output, which reads as a pass to any harness keyed on the + // exit code (measured on Qwen3-0.6B at gpu-kernels b0ed206, 2026-11-13). Refuse here instead, where the + // message can name the fix. Gated on the device so every other backend keeps its q4_0 V support. + // EXPIRY: remove this whole block when gpu-kernels#75 lands -- the refusal is keyed on the device, but its + // reason is a missing kernel, and the moment the writer exists the refusal becomes wrong rather than early. if (params.type_v == GGML_TYPE_Q4_0) { bool on_hrx = false; for (uint32_t il = 0; il < model->hparams.n_layer() && !on_hrx; ++il) { @@ -4159,8 +4162,8 @@ llama_context * llama_init_from_model( on_hrx = name != nullptr && std::strncmp(name, "HRX", 3) == 0; } if (on_hrx) { - LLAMA_LOG_ERROR("%s: the HRX backend has no q4_0 V cache support (no SET_ROWS matcher for a q4_0 " - "target, engine#679); use -ctv q8_0 or f16\n", __func__); + LLAMA_LOG_ERROR("%s: the HRX backend cannot write a q4_0 V cache (no SET_ROWS writer: gpu-kernels#75, " + "engine#679); use -ctv q8_0 or f16\n", __func__); return nullptr; } } From 6cb9eca147c1f5efd6dc8545cddf13d4fb2656f3 Mon Sep 17 00:00:00 2001 From: bcloud Date: Fri, 13 Nov 2026 16:41:43 -0400 Subject: [PATCH 3/3] hrx: the q4_0 refusal's expiry names the READ path, not the writer (engine#679 item 3a) gpu-kernels#75 adds set_rows_q4_0 -- the WRITE half -- and says so itself: '-ctv q4_0 end to end still fails, one node later'. Its body is right, and I verified it at this head: the FA matchers still reject anything but f16 for V, dispatch-flash-attention.cpp:238 value->type != GGML_TYPE_F16 -> reject so my expiry ('remove this block when gpu-kernels#75 lands') would have removed the refusal at exactly the moment the failure moved from the write to attention -- where it fails inside the graph again, which is the exit-0-with-no-output shape this block exists to prevent. Now the expiry names the condition that actually retires it: the read path accepting a q4_0 V, both decode and prompt. Two halves, two conditions. --- src/llama-context.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/llama-context.cpp b/src/llama-context.cpp index 995cd4b1b68e..82a7ef9a8466 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -4152,8 +4152,10 @@ llama_context * llama_init_from_model( // llama-perplexity then exits 0 having produced no output, which reads as a pass to any harness keyed on the // exit code (measured on Qwen3-0.6B at gpu-kernels b0ed206, 2026-11-13). Refuse here instead, where the // message can name the fix. Gated on the device so every other backend keeps its q4_0 V support. - // EXPIRY: remove this whole block when gpu-kernels#75 lands -- the refusal is keyed on the device, but its - // reason is a missing kernel, and the moment the writer exists the refusal becomes wrong rather than early. + // EXPIRY: remove this whole block when the READ path accepts a q4_0 V -- not when the writer lands. gpu-kernels#75 + // adds `set_rows_q4_0`, and the FA matchers still require value->type == GGML_TYPE_F16 + // (dispatch-flash-attention.cpp:238), so a run after #75 fails one node later, at attention, which is the same + // graph-failure-with-no-output shape this refusal exists to prevent. Two halves, two conditions. if (params.type_v == GGML_TYPE_Q4_0) { bool on_hrx = false; for (uint32_t il = 0; il < model->hparams.n_layer() && !on_hrx; ++il) {