Skip to content

pins: llama.cpp 6164e5ba -> d2369fe2, the Q8_1 alias fallback compares the requested value rows, the mixed-layout row reads its own import (llama.cpp#508, #509; engine#3380, #3389) - #3487

Merged
bong-water-water-bong merged 1 commit into
mainfrom
bump-hrx/d2369fe2
Nov 24, 2026

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Carries llama.cpp#508 and #509 into the engine pin — the two fixes for the device regressions the first device-tier run
at 6164e5ba found (the self-hosted gate has been offline since the 1bit OS reinstall, so that run was made by hand).

What moves

The regression: the Q8_1 alias fallback kept the alias source's row shape (#508, engine#3380)

Add-on hrx-ops-test at 6164e5ba was 407 pass / 3 fail / 1 known-fail (it was 399/0/9 at the 23-Nov pin). One
failure class: qwen_decode_split_flash_attention.*.masked.head96.value64 with q8_alternate == nullptr (the 4-query
row fails the plan-size assert first). Cause: #503's Q8_1 comparator required both values' ne[0] to be
128-aligned; the split-FA output publishes its alternate for [64,32,1] and the consumer reads
reshape_2d(..., 2048, tokens) — a pure ordered range over the same bytes, but the source's ne[0] is 64, so the
fallback refused it. At head size 128 the source ne[0] is 128 and the same lookup passed, which is exactly why only
head96/value64 broke. #508 compares the requested value's rows (128-aligned), keeps #503's alias rule (a plain revert
fixes these rows but reopens engine#3383), and moves the two rows to host tier — they never open a device and reproduce
cpp:5440/5420 on a host.

The test bug: the mixed-layout row compared ValueIds across two imports (#509, engine#3389)

mixed_weight_layout_program.q4_k/q6_k compared a ValueId from imported_mixed.graph against bindings of the decode
program's separate import. Ids do not align across imports; the collision matched was the 2048-float activation
(binding length 8192 vs the weight's 215040 bytes). No product path broke and no expectation is re-baselined — the row
reads the decode program's own weight value.

Device evidence (strixhalo gfx1151, root, one box-hold both ticket each, runtime libs from the pin's package)

old vs new on the two FA rows: 23-Nov staged build PASS/PASS; pin 6164e5ba FAIL/FAIL (a fresh rebuild at the pin
  reproduced it, so staging was not the cause)
#508 alone : both FA rows PASS; full add-on 409 passed / 1 failed / 1 known-fail (the 1 being #3389's row)
#509 alone : both mixed rows PASS on add-on AND no-add-on; full add-on 408 passed / 2 failed / 1 known-fail (the 2 FA)
host control: 0/2 at 6164e5ba, 17/17 with #508; reverting #503 alone -> rows pass but #503's host row fails

Per-PR runs only; a combined #508+#509 full device run was not made. test-hrx-ops was already 295/295 at the pin.

Host-side (this branch)

  • cmake --build build --target onebit npu_template_test: clean.
  • ctest -R 'pin|registry|template': 23/23 passed.
  • scripts/pre-pr-checks.sh --tree-only --base origin/main: green; skips hip_f16_audit / kernel_id_selftest
    (no gpu-kernels tree here).

hw_gate label added; the self-hosted runners still cannot run (no git/g++-16/~/lb in the runner environment on
the reinstalled 1bit OS), so the device evidence above is the manual equivalent. No pin rollback is needed: #503 is
kept and corrected.

Closes #3483 (its items 1-2 are device-verified at this pin; item 3, the compile-count/TTFT sweep, stays unmeasured and
is noted there). Refs engine#3380, engine#3389.

…s the requested value's rows, and the mixed-layout row reads its own import (llama.cpp#508, #509; engine#3380, #3389)

Two device regressions found by the first device-tier run at the pin 6164e5ba (the self-hosted gate has been offline since
the 1bit OS reinstall, so this run was made by hand): add-on hrx-ops-test was 407 pass / 3 fail / 1 known-fail.

llama.cpp#508 (engine#3380): find_alternate_value's Q8_1 comparator required BOTH values' ne[0] to be 128-aligned. The
split-FA output publishes its alternate for [64,32,1] and the consumer reads reshape_2d(..., 2048, tokens) -- a pure
ordered range over the same bytes, but the source's ne[0]=64 -- so the fallback refused it and the q8 publish had no
alternate (q8_alternate == nullptr on ...query1.kv512.masked.head96.value64; the 4-query row failed the plan-size assert
first). At head size 128 the source ne[0]=128 and the same lookup passed, which is why only head96/value64 broke. The
row width that matters is the requested value's, which is 128-aligned. A plain revert of #503 fixes it but reopens
engine#3383, so this is a targeted comparator change; the two rows also become host cases (they never open a device and
reproduce cpp:5440/5420 on a host).

llama.cpp#509 (engine#3389): mixed_weight_layout_program.q4_k/q6_k compared a ValueId from imported_mixed.graph against
bindings of the decode program's SEPARATE import. Ids do not align across imports; the collision it matched was the
2048-float activation (binding length 8192 vs the weight's 215040 bytes). No product path broke and no expectation is
re-baselined -- the row now reads the decode program's own weight value.

Device evidence (strixhalo gfx1151, root, one box-hold both ticket, runtime libs from the pin's package):
  before: 23-Nov staged build PASS/PASS on the two FA rows; pin 6164e5ba FAIL/FAIL (and a fresh rebuild at the pin
          reproduced it, so the staging was not the cause)
  #508 alone: both FA rows PASS; full add-on suite 409 passed / 1 failed / 1 known-fail (the 1 being #3389's row)
  #509 alone: both mixed rows PASS on add-on AND no-add-on; full add-on 408 passed / 2 failed / 1 known-fail (the 2 FA)
  host control: 0/2 at 6164e5ba, 17/17 with #508; revert of #503 alone -> rows PASS but #503's host row fails

registry/architectures.json is regenerated by scripts/registry-regen.sh (llama.cpp source sha).

A combined #508+#509 full device run was not made; the two per-PR runs are above. #3483's compile-count/TTFT sweep
(its item 3) remains unmeasured.
@bong-water-water-bong bong-water-water-bong added the hw-gate Run the HRX hardware gate on Strix Halo (docs/hw-gate.md) label Nov 24, 2026
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3389 - Partially compliant

Compliant requirements:

  • The PR updates llama.cpp to d2369fe2 which includes fixes for mixed-layout weight handling (llama.cpp#509)
  • The registry/architectures.json is updated to reflect the new llama.cpp commit

Non-compliant requirements:

  • The PR does not include the actual test case rebuilds to ensure the four mixed-layout scenarios are properly tested with current code

Requires further human verification:

  • Need to verify that the actual test cases in hrx-ops-test now correctly exercise the packed/mixed-layout path with the updated llama.cpp changes

3483 - Partially compliant

Compliant requirements:

  • The PR updates llama.cpp to d2369fe2 which restores dynamic-workload specialization
  • The registry/architectures.json is updated to reflect the new llama.cpp commit

Non-compliant requirements:

  • The PR does not include verification steps or test results for the device-tier validation

Requires further human verification:

  • Device verification must be performed to confirm dynamic-workload launches work correctly on gfx1151
  • Compile counts and TTFT measurements need to be recorded
  • Full hrx-ops-test device tier validation needs to be completed
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Q8_1 alias fallback logic

The Q8_1 alias fallback logic was changed to compare the requested value's rows instead of both values' rows. This fixes a regression where split-FA output with alternate for [64,32,1] was rejected due to source ne[0] being 64 instead of 128-aligned, but may reintroduce engine#3383 if not handled carefully. The change affects how alternate values are matched for Q8_1 types.

Subproject commit d2369fe238f0bf23b7b0337b3ae7f0780105b26f
Mixed layout weight binding

The mixed-weight layout binding logic was fixed to properly compare ValueIds from imports. Previously, it would match against the wrong binding due to ID misalignment across imports, causing incorrect weight binding behavior. This fix ensures that weights are correctly bound in both native and packed layouts when required.

Subproject commit d2369fe238f0bf23b7b0337b3ae7f0780105b26f

@bong-water-water-bong
bong-water-water-bong merged commit 49c21f8 into main Nov 24, 2026
13 of 17 checks passed
@bong-water-water-bong
bong-water-water-bong deleted the bump-hrx/d2369fe2 branch November 24, 2026 12:27
@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

Combined device run at the merged pin (engine main 49c21f82, llama.cpp d2369fe2, gpu-kernels 87bdf514)

The device evidence on this PR was per-PR (#508 alone, #509 alone). This comment is the combined full-suite device run at the merged pin, on Strix Halo (gfx1151, 32 cores, 124 GiB) as root inside box-hold both tickets. The repo's hw-gate workflow cannot run on the box right now (self-hosted runner env: no git, no g++-16, no ~/lb), so the llama.cpp fork's test binaries were built on ryzen with the lanes' flags and staged to the box.

What was built

Source is the pin this PR merged, not a branch: git -C engine-main ls-tree origin/main third_party/llama.cpp -> d2369fe238f0bf23b7b0337b3ae7f0780105b26f; origin/main:config/gpu-kernels.config -> sha=87bdf514f758909948ae714af9ea353d494877de. Add-on checkout: /home/bcloud/.cache/scratch-dv/gpu-kernels (HEAD 87bdf514f758..., 62 kernels).

Built on ryzen, one build at a time, -j 6, warm ccache (add-on 1:16, no-add-on 0:31 wall):

cmake -S . -B build-hrx -G Ninja -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=/usr/bin/gcc-16 -DCMAKE_CXX_COMPILER=/usr/bin/g++-16 \
  -DCMAKE_PREFIX_PATH=/home/bcloud/work/hrx-system/build/hrx-install \
  -DLLAMA_BUILD_TESTS=ON -DLLAMA_CURL=OFF \
  -DGGML_HRX=ON -DGGML_HRX_KERNEL_CORPUS_SOURCE_FORMAT=text \
  -DGGML_HRX_HIP_COMPILER=/home/bcloud/sdk-gfx1201-devel/llvm/bin/amdclang++ \
  -DGGML_HRX_HIP_TARGETS=gfx1151 \
  -DGGML_HRX_HIP_ADDON_DIR=/home/bcloud/.cache/scratch-dv/gpu-kernels/addons/hip-hrx
cmake --build build-hrx -j 6 --target hrx-ops-test test-hrx-ops
# no-add-on: the same configure without -DGGML_HRX_HIP_ADDON_DIR, -B build-hrx-noaddon

Staged to the box with the package runtime libs symlinked as the last lane did (not an Oct-13 hrx-install copy):

  • /data/dev/cl-hrxtest/tests-d2369a (add-on): hrx-ops-test 84949200ed23f469d464dc1ca3c31668, test-hrx-ops 997a6c175ff46f831917c83922dbdf4a, libggml-hrx.so.0 0622a87a6e6e44d14cc607f9918abf5d
  • /data/dev/cl-hrxtest/tests-d2369n (no add-on): hrx-ops-test c38b47a30b819fc3711c8a4df13f76e3, libggml-hrx.so.0 57c53c09116aba4bad5c88ec6da372bf
  • runtime libs (symlinks in both dirs): pkg/hrx/llama/bin/libhrx.so.0 10757295697998877566d0db0b5acc4e, libloomc.so.0 b485ddd8ea03569a8dc66aa23ba6817e
  • env: HRX_ALLOW_NO_SVM=1 HSA_USERPTR_FOR_PAGED_MEM=0 HSA_USE_SVM=0 IREE_HAL_AMDGPU_LIBHSA_PATH=/opt/rocm-therock/lib/libhsa-runtime64.so.1, ulimit -l unlimited, LD_LIBRARY_PATH=<stage>:pkg/hrx/llama/bin

Device run: box-hold both tickets as root (two: the suites, then a test-hrx-ops re-run because its flag prefix differs -- see Environment), every command timeout-bounded (ssh strixhalo 'BOX_HOLD_WHO=lane-hwgate box-hold both sudo -n bash /data/dev/cl-hrxtest/hwgate-d2369-ticket.sh'). Preflight before the long runs: both stages load the runtime and enumerate HRX0 -- hrx-ops-test --hrx-test-list rc 0, 412 cases each, first line is the engine#680 guardrail (GTT total 120.0 GiB ... pool budget 103.7 GiB ... host MemAvailable 121.5 GiB).

Results

row summary rc
add-on hrx-ops-test (full) HRX test summary: 410 passed, 0 failed, 1 known-fail, 0 unexpected-pass, 411 total, 82031 ms 0
add-on test-hrx-ops (full) test-hrx-ops summary: 295 passed, 0 failed, 0 known-fail, 0 unexpected-pass, 295 total, 406027 ms 0
no-add-on hrx-ops-test (full) HRX test summary: 405 passed, 5 failed, 1 known-fail, 0 unexpected-pass, 411 total, 240963 ms 1
add-on, the 4 named rows (--hrx-test-filter) 4 passed, 0 failed, 0 known-fail, 0 unexpected-pass, 4 total, 181 ms 0
no-add-on, the 4 named rows 4 passed, 0 failed, 0 known-fail, 0 unexpected-pass, 4 total, 133 ms 0

The two FA split rows the previous pin broke and #3389's mixed-layout pair, from the ticketed filter run and from inside the two full suites:

  3-addon-rows [PASS]  1/4 qwen_decode_split_flash_attention.query4.kv513.masked.head96.value64   102 ms
  3-addon-rows [PASS]  2/4 mixed_weight_layout_program.q6_k                                       178 ms
  3-addon-rows [PASS]  3/4 mixed_weight_layout_program.q4_k                                       181 ms
  3-addon-rows [PASS]  4/4 qwen_decode_split_flash_attention.query1.kv512.masked.head96.value64   181 ms
  3-noaddon-rows [PASS] 1/4 qwen_decode_split_flash_attention.query1.kv512.masked.head96.value64  115 ms
  3-noaddon-rows [PASS] 2/4 qwen_decode_split_flash_attention.query4.kv513.masked.head96.value64  115 ms
  3-noaddon-rows [PASS] 3/4 mixed_weight_layout_program.q6_k                                      132 ms
  3-noaddon-rows [PASS] 4/4 mixed_weight_layout_program.q4_k                                      132 ms

Full add-on suite: 0 failed, 0 unexpected-pass. The one known-fail row is qwen_flash_attention, labelled "engine#3380: decode-split FA always publishes a Q8_1 alternate that no consumer reads"; it still fails for that same reason (hrx-ops-test.cpp:5143: requirement failed: scheduler.plan().metadata.find_alternate_value(...Q8_1...) == nullptr) and was already the known-fail at 6164e5ba. It names engine#3380, which #3481 closed, so that label is now stale -- a test-annotation cleanup, not a device failure of this pin.

The 5 no-add-on failures are pre-existing (not this pin)

The previous pin's own staged run on this box (same staging pattern, same package runtime libs; /data/dev/cl-hrxtest/runs/dv6164.status, logs dv6164-*.log) had 9 failures in the no-add-on full suite and 3 in the add-on full suite. All five still fail with the same text at 6164e5ba (checked with grep -nE 'requirement failed|missing expected kernel' runs/dv6164-noaddon-hrx-ops-test.log), below from this run's log:

[FAIL]  202/411 dense_matmul_swiglu.q4_k.q4_k.swiglu.tokens1.outputs16384.input4096   4600 ms
        engine#3120: no hip: kernel scheduled for loom_libs:ggml_mul_mat_swiglu_q4_q8_1_x4_lowtoken_dot -- reading the named expectation
        missing expected kernel: loom_libs:ggml_mul_mat_swiglu_q4_q8_1_x4_lowtoken_dot
        scheduled kernels: loom_libs:ggml_kquant_swiglu_decode_f32
[FAIL]  322/411 cpu_host_native_weight.q4_k           41 ms   requirement failed: binding.layout == decode_layout (q4k-packed-k256-row64 vs ggml-native)
[FAIL]  325/411 coherent_subregion_native_weight.q4_k 61 ms   requirement failed: first_stats.weight_materializations == expected_materializations
[FAIL]  326/411 hrx_host_native_weight.q4_k          68 ms   requirement failed: binding.layout == decode_layout (q4k-packed-k256-row64 vs ggml-native)
[FAIL]  329/411 uploaded_native_gated_q4             47 ms   packed_layout_switch: engine #2137 q4_k batches off the 256 grid ... (GGML_HRX_Q4K_PACKED_TAIL=unset)
                                                             missing expected kernel: loom_libs:ggml_mul_mat_swiglu_f32_f32_lowtoken_dot

Two of them are engine#3120 add-on-route rows: with no HIP add-on there is no hip: kernel, the row falls through to the named Loom expectation (require_kernel_subsequence_route) and the Loom route does not schedule that kernel for the shape. The other three are packed/native layout expectations the no-add-on (native) path does not meet. Same rows, same text, at 6164e5ba -- this pin neither adds a failure nor fixes these five.

Control: previous pin vs merged pin, same box and staging pattern

suite 6164e5ba (previous pin, runs/dv6164) d2369fe2 (this run)
add-on hrx-ops-test full 407 passed, 3 failed (mixed q6_k, FA q1, FA q4), 1 known-fail 410 passed, 0 failed, 1 known-fail
add-on test-hrx-ops full 295 passed, 0 failed 295 passed, 0 failed, 406027 ms
no-add-on hrx-ops-test full 401 passed, 9 failed (5 pre-existing + mixed q4_k/q6_k + FA q1/q4) 405 passed, 5 failed (the 5 pre-existing), 1 known-fail

So the merged pin turns the add-on suite green and takes the no-add-on suite from 9 failures to the 5 that were already failing at 6164e5ba; the mixed-layout pair and the FA split pair now pass in both builds (in the full suites and alone).

Environment

  • dmesg: no amdgpu reset, wedged, page fault or ring timeout in either ticket window (12:32:55Z - 12:38:24Z and 12:38:45Z - 12:45:31Z); the newest such line in the log is at uptime 2737 s (~11:03Z, an hour and a half before these runs, from an earlier job). Tctl 39 C -> 34 C in the first ticket, 32 C -> 37 C in the second.
  • test-hrx-ops is run under its own flag prefix: HRX_OPS_TEST_OUTPUT=all. The first ticket invoked it with hrx-ops-test's flags (--hrx-test-output all), which its parser rejects (rc 2 before a case ran); it was re-run in a second box-hold both ticket with the correct env, and that is the summary above.

Logs on the box (strixhalo)

  • status: /data/dev/cl-hrxtest/runs/hwgate-d2369.status, /data/dev/cl-hrxtest/runs/hwgate-d2369b.status
  • add-on full: /data/dev/cl-hrxtest/runs/hwgate-d2369-1b-addon-hrx-ops-test.log
  • add-on test-hrx-ops: /data/dev/cl-hrxtest/runs/hwgate-d2369b-addon-test-hrx-ops.log
  • no-add-on full: /data/dev/cl-hrxtest/runs/hwgate-d2369-2-noaddon-hrx-ops-test.log
  • named rows: /data/dev/cl-hrxtest/runs/hwgate-d2369-3-addon-rows.log, .../hwgate-d2369-3-noaddon-rows.log
  • failure detail re-runs: /data/dev/cl-hrxtest/runs/hwgate-d2369-fail-*.log
  • scripts: /data/dev/cl-hrxtest/hwgate-d2369-ticket.sh, .../hwgate-d2369-ticket-b.sh
  • build logs (ryzen): /home/bcloud/.cache/scratch-hwgate/{configure-addon,configure-noaddon,build-addon,build-noaddon}.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hw-gate Run the HRX hardware gate on Strix Halo (docs/hw-gate.md) Review effort 2/5

Projects

None yet

Development

Successfully merging this pull request may close these issues.

device verification: the restored dynamic-workload launches have not run on gfx1151 (pinned by #3481)

1 participant