Skip to content

pins: llama.cpp 39ed69b58 -> c6c654c3, the alternate-value fallback compares layouts, not just ranges (llama.cpp#503; engine#3383) - #3475

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

bong-water-water-bong merged 1 commit into
mainfrom
bump-hrx/c6c654c3

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

Carries llama.cpp#503 into the engine pin: the alternate-value fallback now compares layouts, not only storage
ranges. This is the engine-side half of #3383.

What moves

  • third_party/llama.cpp 39ed69b58 -> c6c654c3 (llama.cpp#503)
  • registry/architectures.json: regenerated by scripts/registry-regen.sh (llama.cpp source sha; 354
    architectures, no architecture change)
  • config/gpu-kernels.config does not move (no add-on change in this pin).

Why

ggml::hrx::find_alternate_value() handed a transposed view (contiguous = false, bytes permuted) or a value
whose producer writes the storage (CPY, SET_ROWS) the root's Q8_1 alternate whenever
same_full_value_range() matched -- storage, offset and byte_count only -- so a kernel read a copy that did not
hold the value it thought it held (requirement through_reordered_alias == nullptr, engine#3383).

llama.cpp#503 makes the three fallbacks compare with the ordered comparators that AMD's generated-resource path
already used: an alternate is accepted only if it is a pure reshape over the same ordered bytes (F16: full ordered
range; Q8_1: x4 128-element rows; other formats: packed rows), a value whose producer is not a layout alias is
refused, and the alias walk stops at a value its own producer wrote -- the graph index is the only record of a
write that reused the storage, so an unindexed graph gets no fallback. import_ggml_graph() always builds that
index (graph/graph.cpp:202), so every dispatch caller has it.

Control (host tier, the fork's own build)

Same tree, pre-fix vs post-fix (cmake -DGGML_HRX=ON -DLLAMA_BUILD_TESTS=ON, -j 6):

support.alternate_value_alias_lookup, pre-fix 39ed69b58:
  FAIL tests/hrx-ops-test.cpp:854: requirement failed: through_reordered_alias == nullptr   (exit 134)
support.alternate_value_alias_lookup, post-fix c6c654c3: pass (exit 0)

full host tier, pre-fix : 9 passed, 0 failed, 1 known-fail, 10 total
full host tier, post-fix: 10 passed, 0 failed, 0 known-fail, 10 total   (the case left known_fail_host_case)
check_stale_expectations.py --check: 490 expectation literals, every one selectable; --self-test ok

The device tier is unchanged by this row (it is a host case); the 398 device cases are skipped host-side with the
suite's standard skip line.

Host-side (this branch)

  • cmake --build build --target onebit: clean.
  • ctest -R 'pin|registry|template': 23/23 passed (registry_pins, registry_pins_staged, pin_mirror,
    pin_holdings, template_pin, submodule_pin_check, ...).
  • scripts/pre-pr-checks.sh --tree-only --base origin/main: green; the two skips are hip_f16_audit and
    kernel_id_selftest (no gpu-kernels tree here -- their own environment reason).

hw_gate label added. hw_gate/hrx_build cannot run: the self-hosted strixhalo-engine/strixhalo-bench
runners are offline (the box runs 1bit OS since the c35 install and the runner units are not present), which is the
same state #3424, #3407 and #3462 merged under. The substitute for the changed code is the fork's own GGML_HRX=ON
build and the host-tier control above -- the changed header never enters libhrx/libloomc and the device rows do
not exercise this fallback differently.

Closes #3383.

…ompares layouts, not just ranges (llama.cpp#503; engine#3383)

find_alternate_value() handed a transposed view or a CPY producer the root Q8_1 alternate whenever
same_full_value_range() matched -- storage, offset and byte_count only -- so a kernel read a copy that did not
hold the value it thought it held (the through_reordered_alias requirement).

llama.cpp#503 makes the three fallbacks compare with the ordered comparators: a pure reshape over the same
ordered bytes still takes the alternate, an alias whose producer is not a layout alias is refused, and the alias
walk stops at a value its own producer wrote (imported graphs always carry the index).

Host-tier control, same tree: support.alternate_value_alias_lookup FAILs at 39ed69b58
(hrx-ops-test.cpp:854: through_reordered_alias == nullptr) and passes after; the full host tier goes from
9 passed / 1 known-fail (10 total) to 10 passed / 0 known-fail. The device tier is unchanged by this row.

registry/architectures.json is regenerated by scripts/registry-regen.sh (llama.cpp source sha; no architecture
change).
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

3383 - Partially compliant

Compliant requirements:

  • The find_alternate_value function now compares layouts, not just storage ranges
  • The fallbacks properly check for contiguous layouts and element order
  • Alias traversal stops at values whose producers wrote to the storage
  • The test support.alternate_value_alias_lookup now passes

Non-compliant requirements:

  • None

Requires further human verification:

  • None
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Layout Comparison Fix

The find_alternate_value function now correctly compares layouts instead of just storage ranges, ensuring that transposed views or values from CPY/SET_ROWS producers are not incorrectly matched with alternates. This prevents kernels from reading incorrect data due to layout mismatches.

Subproject commit c6c654c3d4c3debc4dc6755f24e7b0e8fc73a866

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.

hrx: find_alternate_value hands a transposed view or a CPY into the same storage the root's Q8_1 alternate

1 participant