Skip to content

third_party/llama.cpp: pin to 8c12dfa63 — delta-net decode reads recurrent states in place (+3.2 % at 4 streams, llama.cpp#388) - #2461

Merged
bong-water-water-bong merged 1 commit into
mainfrom
cl-1051/fork-pin-388
Nov 15, 2026
Merged

bong-water-water-bong merged 1 commit into
mainfrom
cl-1051/fork-pin-388

Conversation

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator

What

third_party/llama.cpp: f3d177a40 → 8c12dfa63, one commit, plus the registry pin line it implies.

8c12dfa63  llama-graph: read recurrent states in place when the state copy is an identity (+3.2 % at 4 streams, Qwen3.8-27B) (llama.cpp#388)

When every sequence sits in its own recurrent cell, with no cleared state and no pending rollback, build_rs returns a view of the ubatch's state rows instead of a GET_ROWS gather onto themselves. Scope: the gated-delta-net families (QWEN35 / QWEN35MOE / QWEN3NEXT), one token per sequence. The aliasing contract is stated at the return site and was reviewed on #388.

registry/architectures.json changes by the one pin line; tools/registry_build.py --check-pins is rc 0.

Measured (llama.cpp#388, Qwen3.8-27B Q4_K_M sha 880a52af, gfx1151)

  • 4 streams, c4_steady.py, -np 4 -kvu, A B A B, coder-llm idle: 39.2 / 39.1 → 40.2 / 40.6 agg tok/s (+3.2 %).
  • Decode-path KLD (-ub 1) is the same size as swapping the fused conv kernel out (0.000287 vs 0.000259).
  • 1-stream tok/s is unchanged.

Verified at the pin

Build: engine cmake --build rc 0 at 8c12dfa63 (gpu-kernels at the pinned 2022afb74). Fork ninja -k 0: only four gpu-kernels harness/tool targets fail, with "cannot find ROCm device library": test-nvfp4, ssm-scan-bounds-check, glm-mla/moe-decode-harness. The same four fail at the base pin.

Suites, one gpu-hold ticket, no amdgpu fault (run on main 3c11dbd; rebased onto a2cff92, whose two new commits are npu / pre-pr-checks and do not touch the fork or the registry):

suite at 8c12dfa63 at base f3d177a40 (same binary set, rebuilt)
hrx-ops-test --hrx-test-filter ssm_conv (incl. #388's ssm_conv_decode.in_place_state{,.schedule}) 8/8 PASS –
fork ctest 9 of 104 fail the same 7 fail: test-tokenizers-ggml-vocabs, test-kv-zero, test-llama-archs, test-llama-context, test-hrx-fa-transposed-value, test-hrx-mul-mat-id-k32, test-hrx-fa-masked-v
engine ctest (235, NPU tests excluded) laya_gguf_route fails laya_gguf_route fails

The other two failures at the pin, test-thread-safety and test-eval-callback, are my exclusion. I excluded test-download-model, which downloads tinyllamas/stories15M-q4_0.gguf, and both load that file. In the base run ctest pulled the download in as a dependency and both passed. Re-running them at the pin with the model present is queued; I will post the result here.

Not run, and not claimed

Refs llama.cpp#388, engine C4-STREAMS.

🤖 Generated with Claude Code

…rent states in place (+3.2 % at 4 streams)

f3d177a40 -> 8c12dfa63, one commit: llama.cpp#388. When the recurrent state copy is an identity (every sequence in its
own cell, no cleared state, no pending rollback), build_rs returns a view of the ubatch's state rows instead of a
GET_ROWS gather. Gated-delta-net families (QWEN35 / QWEN35MOE / QWEN3NEXT), one token per sequence. Qwen3.8-27B
Q4_K_M, 4 streams (c4_steady, -np 4 -kvu): 39.2 / 39.1 -> 40.2 / 40.6 tok/s. registry/architectures.json records the
new pin (registry_build.py --check-pins rc 0).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis 🔶

388 - Partially compliant

Compliant requirements:

  • The PR updates the llama.cpp pin to resolve the merge conflict issue
  • The PR updates the registry/architectures.json to reflect the new pin

Non-compliant requirements:

  • The PR does not explicitly state that the merge conflicts were resolved manually on the specified branches

Requires further human verification:

  • Verification that the merge conflicts were properly resolved on 1bit/hrx-vulkan-patched or 1bit-MONSTER/hrx-system 1bit/main
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Pin Update Verification

The PR updates the llama.cpp pin in registry/architectures.json but does not verify that the new pin resolves the merge conflicts that caused the bump-hrx workflow to fail. The update should be confirmed to have resolved the specific merge conflicts mentioned in the ticket.

"llama.cpp (hrx)": "8c12dfa634ac0040d81ccdc50d41c4e3af5ffb7b"

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

The two failures I attributed to my own fixture exclusion pass at the pin with the model present. Same build tree (8c12dfa63), gpu-hold ticket cl1051-c4-step2, 00:32Z:

ctest -R '^(test-thread-safety|test-eval-callback)$'
1/2 Test  #48: test-thread-safety ...............   Passed    2.93 sec
2/2 Test #110: test-eval-callback ...............   Passed    0.14 sec
100% tests passed, 0 tests failed out of 2

So every failure at the pin also fails at the base pin f3d177a40, and #388 adds none.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT: READY at 3647b74 — the pin is the head, it carries exactly one commit, and that commit's aliasing condition is the conservative kind.

The pin, checked against the remote rather than a ref

git ls-remote refs/heads/1bit/hrx-vulkan-patched   ->  8c12dfa634
this PR pins                                       ->  8c12dfa634ac…
commits head has that the pin lacks                ->  0
engine today pins                                  ->  f3d177a4039b

So it is a single-commit forward move, gitlink and registry/architectures.json agree (8c12dfa634ac… in both), and at the PR's own tree tools/registry_build.py --check-pins is rc 0.

The commit's aliasing predicate is the part that matters, and it is conservative

The change reads recurrent states in place instead of gathering them onto themselves, which is only sound when the gather really is an identity. s_copy_is_identity() decides that, and it refuses on every case that would make the view wrong:

if (get_rs_z() >= 0) return false;                       // a cleared state exists
for each row i:  if (cells[idx].src0 != (int32_t) idx) return false;   // the cell does not read its own row
                 if (... rs_idx[seq] != 0) return false;               // a rollback reads an OLDER snapshot row

src0 == own cell is exactly "the GET_ROWS source is the row it writes", and the two refusals cover the states where a copy still carries information. Scope is named too — the gated-delta-net families, one token per sequence — so the aliasing contract is a narrowing, not a global assumption.

The test asserts the two paths are mutually exclusive, which is the right shape

+// ... whose state is either gathered (get_rows, a copy) or read in place from the cache row the update writes back
+REQUIRE(fused == !in_place);

That single assertion is what keeps a fast path from silently crossing into the case it is not valid for: the fused decode kernel is required to be used only when the state is not in place. A test that only exercised the in-place arm would pass just as happily with the predicate inverted.

Measured, and the numbers are the honest size

4 streams, c4_steady.py, -np 4, A B A B with coder-llm idle: 39.2 / 39.1 → 40.2 / 40.6 agg tok/s (+3.2 %); 1-stream unchanged; decode-path KLD the same size as swapping a fused conv kernel out (0.000287 vs 0.000259) — i.e. the alias path does not move the distribution more than a legitimate kernel choice does. An A/B/A/B against an idle box is the design that makes a 3.2 % claim readable at all.

Nothing to ask. One commit, one pin line, a predicate that refuses the three cases where aliasing would lie, and a test that pins the boundary between the two paths.

@bong-water-water-bong

Copy link
Copy Markdown
Collaborator Author

VERDICT at 3647b74: READY — pin is the tip, the delta is one commit, and the engine builds it, which for this particular commit is the check that matters.

The pin, against the remote

git ls-remote origin refs/heads/1bit/hrx-vulkan-patched  ->  8c12dfa63
this PR pins                                             ->  8c12dfa63
f3d177a40..8c12dfa63  ->  one commit
--check-pins at this head -> rc 0, registry records 8c12dfa634ac

Engine build at the pin (the part a fork build cannot tell you)

CFG_RC=0   BUILD_RC=0   0 real compile errors      (the 2 the log grep finds are /usr/include/c++/16/system_error)
493 objects under third_party/llama.cpp/{src,tools}
<build>/hrx/llama/bin/llama-server   built, not a prebuilt drop

That matters more than usual here: the delta is not test-only. src/llama-graph.cpp +47, llama-memory-recurrent.cpp +19, and the change is an aliasing decision — build_rs returning a view of the ubatch's state rows instead of a GET_ROWS gather onto themselves. Fork-compiles says little about that; engine-compiles-and-links-from-the-pin says the integration is real. (No ONEBIT_HRX_SERVER/ONEBIT_BINARY_DROP_HRX_BIN in the cache, so the served binary is built from third_party/llama.cpp at the pin, not from a drop.)

The scope statement is the useful half of the description

every sequence in its own recurrent cell, no cleared state, no pending rollback → view instead of gather; families QWEN35 / QWEN35MOE / QWEN3NEXT; one token per sequence; the aliasing contract stated at the return site

That is the right way to describe an aliasing optimisation: four conditions and an enumerated family set, so a reviewer can ask "does the condition cover my case" instead of guessing. It also ships with tests — tests/hrx-ops-test.cpp +94 — which is why the registry-and-build checks are enough for me to say READY without a device.

Two things I am not verifying, and one that has now bitten twice

  • +3.2 % at 4 streams on Qwen3.8-27B — device measurement, no ticket. Not claimed.
  • the aliasing correctness at runtime — needs a served model; the +94 lines of op tests are the substitute I can honestly point at.

And the measurement artefact: the body cites Qwen3.8-27B Q4_K_M sha 880a52af, which on this box is a dangling symlink (76 bytes, target deleted) — the same file gpu-kernels#86 measured on earlier. The number is not in doubt; the recipe is, and it is worth one line in the body saying the blob is gone so the next lane does not spend an hour discovering it. That is the second PR tonight citing that path.

@bong-water-water-bong bong-water-water-bong left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

VERDICT: READY -- the failure table is the part that makes a pin landable, and one behaviour change is still unnamed

This is how a pin bump's evidence should look: a build at the pin (rc 0, gpu-kernels at 2022afb74), the same four harness failures at the base pin ("cannot find ROCm device library"), the fork ctest compared at the pin against the base with the same binary set -- 9 of 104 versus the same 7, with the extra two named and traced to an exclusion of mine (test-download-model, which fetches tinyllamas/stories15M-q4_0.gguf), and a re-run promised with the model present. Naming the pre-existing failures is what a reader needs; naming the difference from base is what makes it a claim about the pin rather than about the box. hrx-ops-test --hrx-test-filter ssm_conv at 8/8 PASS covers ssm_conv_decode.in_place_state{,.schedule} -- the two cases #388 added.

Declining the unfiltered hrx-ops-test is right, and for the right reason: an unfiltered run reset the GPU twice on 11-13. Reporting a filtered run and saying why is the opposite of reporting an unfiltered one that happened to survive.

The ask, carried from my #388 review, and it matters more at a pin than in the PR: this bump changes single-stream arithmetic. At 1 row the conv now runs the separate kernels instead of the fused decode kernel, so 1-slot greedy output differs from base at char 321 / 826 of 256-token answers -- deterministic, inside the KLD envelope of swapping the fused conv kernel out (0.000287 ± 0.000018 vs 0.000259 ± 0.000015), and not what "1-stream tok/s is unchanged" says to a reader. Anyone holding golden outputs, a stored baseline, or a bit-exact expectation against the previous pin will see text change, and the pin body is where they will look for it. One sentence: "1-stream greedy output changes at this pin (separate conv kernels instead of the fused one, KLD-equivalent to swapping that kernel); tok/s is unchanged."

Nothing else: the aliasing contract is stated at the return site and was reviewed on #388, the registry pin line moves with --check-pins rc 0, and the 87 NPU-labelled tests being out of scope is a correct exclusion rather than a gap (no npu-hold ticket in this run).

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant