Repository navigation
Conversation
bong-water-water-bong
added a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 10, 2026
…tch for the transposed V and 256-token launches (engine ggml-org#1989) (#289) From 256 query tokens the prefill FLASH_ATTN_EXT dispatch copies V into a transposed buffer and the attention kernel walks it across channels. Two things made that slow at long key counts: - the buffer's rows were 2 x keys bytes apart, so at key counts where that is a multiple of the page size (16,384, 32,768, ...) the channels of a key block shared cache sets. A key count that is a multiple of 64 now gets a pitch of keys + 32; the transpose kernel writes at that pitch and the attention kernel reads at it (two new config values, both defaulting to the packed layout); - one launch over 512 query tokens was slower per token than two over 256 from about 4,096 keys up. From 4,096 keys the dispatch now runs 256-token launches over the one transposed buffer; below that it keeps one launch. GGML_HRX_FA_VALUE_PITCH and GGML_HRX_FA_QUERY_CHUNK are diagnostic overrides (0 and 2048 give the old layout). tests/test-hrx-fa-transposed-value.cpp: values against the CPU backend and the launch plan, 8 cases. Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
bong-water-water-bong
pushed a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 10, 2026
…ount, so a new key count compiles no new kernel (engine ggml-org#1989) The first version passed the pitch to the attention kernel as a compile parameter, which made every distinct key count a new kernel specialisation. llama-bench hides that in its first repetition; a real run ingesting a 9,230-token prompt took 53 s against 33 s on a loaded box. value_layout 2 now means 'transposed, spread pitch' and the kernel computes keys + 32 for a key count that is a multiple of 64, the rule the dispatcher uses for the buffer. The transpose kernel already specialises on the row count, so its pitch stays a config value. GGML_HRX_FA_VALUE_PITCH is now on/off (0 = packed). Co-Authored-By: Claude Fable 5.2 <[email protected]>
bong-water-water-bong
added a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 10, 2026
…ount, so a new key count compiles no new kernel (engine ggml-org#1989) (#291) The first version passed the pitch to the attention kernel as a compile parameter, which made every distinct key count a new kernel specialisation. llama-bench hides that in its first repetition; a real run ingesting a 9,230-token prompt took 53 s against 33 s on a loaded box. value_layout 2 now means 'transposed, spread pitch' and the kernel computes keys + 32 for a key count that is a multiple of 64, the rule the dispatcher uses for the buffer. The transpose kernel already specialises on the row count, so its pitch stays a config value. GGML_HRX_FA_VALUE_PITCH is now on/off (0 = packed). Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
bong-water-water-bong
added a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 11, 2026
…d (engine ggml-org#2068) (#295) * tests: hrx-backend-test compiles again after the alias_miss field (#262) #262 added ValueMap's alias_miss field before the optional buffer binding. Two aggregate initialisers in hrx-backend-test still passed std::nullopt in that position, so the test has not compiled since. They now pass AliasMiss::None. Co-Authored-By: Claude Fable 5.2 <[email protected]> * tests: hrx-backend-test expects the transposed V's spread pitch (engine ggml-org#1989) qwen_flash_attention_dispatch still required the transposed V to be keys x columns long with value_layout 1. Since llama.cpp #289/#291 the buffer has the spread pitch (keys + 32 when the key count is a multiple of 64), the transpose kernel is told the pitch and the attention kernel derives it (value_layout 2). The dispatch is right; the expectation was stale, and a compile error in this file (fixed by #293) hid it. The check now asserts the pitch, the packed source binding, the transpose kernel's output_pitch and that the pitch is not a compile parameter of the attention kernel. host: 63 passed, 3 failed -> 64 passed, 2 failed (the two left, :1858 and :6333, are not from this change). Co-Authored-By: Claude Fable 5.2 <[email protected]> * tests: hrx-backend-test's two other stale host rows follow the backend (engine ggml-org#2068) The test did not compile from #262 until #293, so host rows drifted from changes that were made on purpose. #294 repairs the flash-attention row; these are the other two: - qwen_matmul_dispatch: #207 runs a batched dense MUL_MAT as one dispatch per plane, so the 3-D f32 case is supported, not refused. - unmatched_graph_diagnostics: #196's standalone SET_ROWS takes the i32-index graph the row used as its unmatched example. The row now uses a row width above that dispatch's limit, which every matcher still declines. Co-Authored-By: Claude Fable 5.2 <[email protected]> --------- Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
bong-water-water-bong
added a commit
to 1bit-MONSTER/llama.cpp
that referenced
this pull request
Nov 11, 2026
…st check my #289 left stale; engine ggml-org#1989) (#294) * tests: hrx-backend-test compiles again after the alias_miss field (#262) #262 added ValueMap's alias_miss field before the optional buffer binding. Two aggregate initialisers in hrx-backend-test still passed std::nullopt in that position, so the test has not compiled since. They now pass AliasMiss::None. Co-Authored-By: Claude Fable 5.2 <[email protected]> * tests: hrx-backend-test expects the transposed V's spread pitch (engine ggml-org#1989) qwen_flash_attention_dispatch still required the transposed V to be keys x columns long with value_layout 1. Since llama.cpp #289/#291 the buffer has the spread pitch (keys + 32 when the key count is a multiple of 64), the transpose kernel is told the pitch and the attention kernel derives it (value_layout 2). The dispatch is right; the expectation was stale, and a compile error in this file (fixed by #293) hid it. The check now asserts the pitch, the packed source binding, the transpose kernel's output_pitch and that the pitch is not a compile parameter of the attention kernel. host: 63 passed, 3 failed -> 64 passed, 2 failed (the two left, :1858 and :6333, are not from this change). Co-Authored-By: Claude Fable 5.2 <[email protected]> --------- Co-authored-by: bong-water-water-bong <[email protected]> Co-authored-by: Claude Fable 5.2 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main purpose is changing iteration number.
Because current 10 loop iteration is not making stable result.
However, it is still not stable at 10,000 and 100,000 iterations. why ...