Repository navigation
llama : keep the k-pool layout prefix on sequence edits - #32137
Conversation
Assisted-by: Claude Code
|
changes look ok, automated review below Tested on an RTX PRO 6000 with The change looks correct to me. An edit at Time per
The test needs some work:
Smaller things:
|
* Append and edit share one branch, using stale > sq.pos_min. * LLAMA_KPOOL_VERIFY=1 checks every update against a full rebuild. The scan moved into kpool_scan() so the check can reuse it. * The test turns the check on for its rollback context, skips -sm tensor, and drops kimi-k31. * Two comments that were no longer true are fixed. Assisted-by: Claude Code
| nullptr, filter_idx, nullptr, nullptr, "idx_"); | ||
| }()) {} | ||
| }()) { | ||
| const char * LLAMA_KPOOL_VERIFY = getenv("LLAMA_KPOOL_VERIFY"); |
|
Just wanted to comment I independently worked the same issue tonight (because search is hard, sigh). But the reason to add here is that the performance hit was very significant in my case; Qwen 3.8 Flash Next Q8, running on RTX5000, at ~80% of a 256K context I was getting 20% of the performance of a fresh context. Like @Maddimax I was seeing ~25% utilization on the GPUs because they were stalled waiting for the single threaded CPU core. My patch is functionally equivalent so I'll leave it out, but this is quite impactful. |
|
Just need to remove the env flag I think |
|
The ai policy of this project is annoying me to the point where im not really willing to work on this anymore. Feel free to take it over, i will keep my own fork going for myself.Sent from my iPhoneOn 15. Nov 2026, at 08:33, Aman Gupta ***@***.***> wrote:am17an left a comment (ggml-org/llama.cpp#32137)
Just need to remove the env flag I think
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
|
@ServeurpersoCom @sanmai for a final look |
|
GPU usage did went up from 40% to about 42% at 145k context with MTP. Benchmarks are positive.
(I updated the table with the correct config labels; there were no differences in acceptance) |
* origin/master: (138 commits) qwen4exp : fix graph reallocation from the n-gram table scale (ggml-org#32483) server : return 400 when grammar and ignore_eos are on (ggml-org#32377) ggml-cuda: disable quantized matvec fusion on all Pascal GPUs (ggml-org#32239) Title: CUDA: few-row MMQ for MUL_MAT_ID (ggml-org#32065) ui: turn the live markdown preview off by default (ggml-org#32469) CUDA: use block reductions for whole-row pool_1d (ggml-org#31855) ggml : decode F8_E4M3 to fp32 without ldexpf (ggml-org#32477) llama : keep the k-pool layout prefix on sequence edits (ggml-org#32137) vocab : speed up PLaMo-2/3 tokenizer table build (ggml-org#32249) convert : fix FP8 qwen4exp checkpoints (n-gram table scale, block-scaled FP8) (ggml-org#32476) ui: Llama UI design system: tokens, surfaces and fonts (ggml-org#32468) mtmd: support Minimax-Music3 (ggml-org#32435) chat: add tts_dict for kokoro G2P template (ggml-org#32397) Rotate K/V read order for better L2 cache hit rates (ggml-org#32407) ui: turn conversation tabs off by default (ggml-org#32402) ui: move Llama Chat to SvelteKit 3 and its built-in service worker (ggml-org#32463) qwen3next : apply output projection weight scale (ggml-org#32393) cuda : raise shared mem limit only for the launched kernel (ggml-org#32392) nix: expose a SYCL package (ggml-org#31066) vulkan: disable flip Flash Attention shader on AMD Windows due to a driver bug (ggml-org#32415) ...
Upstream: ggml-org/llama.cpp d3064fd..08a9b35 (2 commits) Conflicts: - tests/test-llama-archs.cpp: kept both new functions, the fork test_merged_weights and upstream ggml-org#32137 check_draft_rollback; the fork function gets its closing brace back at the junction. Assisted-by: Claude Opus 5.5 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01YKmjzcT1LTvKtbw9EzBVGE
* llama : keep the k-pool layout prefix on sequence edits Assisted-by: Claude Code * llama : address review of the k-pool layout update * Append and edit share one branch, using stale > sq.pos_min. * LLAMA_KPOOL_VERIFY=1 checks every update against a full rebuild. The scan moved into kpool_scan() so the check can reuse it. * The test turns the check on for its rollback context, skips -sm tensor, and drops kimi-k31. * Two comments that were no longer true are fixed. Assisted-by: Claude Code * llama : check the k-pool layout update in debug builds instead of LLAMA_KPOOL_VERIFY * llama : remove the k-pool layout verification * llama : inline the k-pool scan again * remove dangling new line * do not search twice --------- Co-authored-by: Aman Gupta <[email protected]> Co-authored-by: Alexey Kopytko <[email protected]>
* llama : keep the k-pool layout prefix on sequence edits Assisted-by: Claude Code * llama : address review of the k-pool layout update * Append and edit share one branch, using stale > sq.pos_min. * LLAMA_KPOOL_VERIFY=1 checks every update against a full rebuild. The scan moved into kpool_scan() so the check can reuse it. * The test turns the check on for its rollback context, skips -sm tensor, and drops kimi-k31. * Two comments that were no longer true are fixed. Assisted-by: Claude Code * llama : check the k-pool layout update in debug builds instead of LLAMA_KPOOL_VERIFY * llama : remove the k-pool layout verification * llama : inline the k-pool scan again * remove dangling new line * do not search twice --------- Co-authored-by: Aman Gupta <[email protected]> Co-authored-by: Alexey Kopytko <[email protected]>
* llama : keep the k-pool layout prefix on sequence edits Assisted-by: Claude Code * llama : address review of the k-pool layout update * Append and edit share one branch, using stale > sq.pos_min. * LLAMA_KPOOL_VERIFY=1 checks every update against a full rebuild. The scan moved into kpool_scan() so the check can reuse it. * The test turns the check on for its rollback context, skips -sm tensor, and drops kimi-k31. * Two comments that were no longer true are fixed. Assisted-by: Claude Code * llama : check the k-pool layout update in debug builds instead of LLAMA_KPOOL_VERIFY * llama : remove the k-pool layout verification * llama : inline the k-pool scan again * remove dangling new line * do not search twice --------- Co-authored-by: Aman Gupta <[email protected]> Co-authored-by: Alexey Kopytko <[email protected]> (cherry picked from commit 08a9b35)
* llama : keep the k-pool layout prefix on sequence edits Assisted-by: Claude Code * llama : address review of the k-pool layout update * Append and edit share one branch, using stale > sq.pos_min. * LLAMA_KPOOL_VERIFY=1 checks every update against a full rebuild. The scan moved into kpool_scan() so the check can reuse it. * The test turns the check on for its rollback context, skips -sm tensor, and drops kimi-k31. * Two comments that were no longer true are fixed. Assisted-by: Claude Code * llama : check the k-pool layout update in debug builds instead of LLAMA_KPOOL_VERIFY * llama : remove the k-pool layout verification * llama : inline the k-pool scan again * remove dangling new line * do not search twice --------- Co-authored-by: Aman Gupta <[email protected]> Co-authored-by: Alexey Kopytko <[email protected]>
Assisted-by: Claude Code
Overview
I realized that my GPU was not used to ~100% during long running coding sessions. I asked claude to investigate
and it found that the kpool_layout_update was taking a lot of CPU. I asked it to try and fix it and this is the result.
I don't have any experience with the code so its hard for me to judge, I can only report that my GPU usage is closer to 100% now.
Additional information
Claude said:
Requirements