Repository navigation
Use F16 for memory_k and memory_v (as suggested in #146) - #154
Closed
ty-everett wants to merge 1 commit into
Closed
ty-everett wants to merge 1 commit into
ty-everett wants to merge 1 commit into
Conversation
Collaborator
|
can confirm it is hard to tell if the quality changes, but the prediction does (obviously). |
Member
|
I was worried that it might degrade quality, but I have no evals as you can guess. |
2 of 6 tasks
Collaborator
Collaborator
|
@ty-everett are you going to write the cli-param conditional version? if not, I will do it. |
This was referenced Mar 18, 2023
Deadsg
pushed a commit
to Deadsg/llama.cpp
that referenced
this pull request
Dec 19, 2023
Slim-Bullseye based docker image
Seunghhon
pushed a commit
to Seunghhon/llama.cpp
that referenced
this pull request
Apr 26, 2026
…gml-org#154) (ggml-org#294) * Use F16 for memory_k and memory_v * add command line switch to use f16 instead of f32 for memory k+v --------- Co-authored-by: Ty Everett <ty@tyweb.us>
phuongncn
pushed a commit
to phuongncn/llama.cpp-gx10-dgx-sparks-deepseekv4
that referenced
this pull request
Apr 28, 2026
* iq2_xxs_r4: Zen4 Disapointing gain: 134.7 t/s -> 151.1 t/s for PP-512 TG-128 is better: 3.45 -> 4.61 t/s @ 1 thread * Minor * iq2_xxs_r4: NEON --------- Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
ljubomirj
pushed a commit
to ljubomirj/llama.cpp
that referenced
this pull request
May 6, 2026
…gml-org#154) (ggml-org#294) * Use F16 for memory_k and memory_v * add command line switch to use f16 instead of f32 for memory k+v --------- Co-authored-by: Ty Everett <ty@tyweb.us>
drizzt
pushed a commit
to drizzt/llama.cpp
that referenced
this pull request
Jun 15, 2026
… 570+ (ggml-org#154) Two NVIDIA driver bugs on Blackwell GPUs (RTX 50xx series) with Linux driver versions 570+ cause illegal memory access during llama.cpp KV cache init: Bug 1: cudaMemsetAsync with cudaStreamPerThread - cudaMemsetAsync(ctx->dev_ptr, value, buffer->size, cudaStreamPerThread) -> cudaStreamSynchronize -> illegal memory access in memset32 kernel - Fix: replace with synchronous cudaMemset (avoids per-thread async stream) Bug 2: cudaEventCreateWithFlags(event, cudaEventDisableTiming) - illegal memory access on compute capability 12.0 GPUs - Fix: replace with plain cudaEventCreate (no flags) These fix crashes during model load and KV cache initialization that affect all current llama.cpp CUDA builds on RTX 50xx hardware. Reported-by: Aggroed (aggressive.lighthacker@gmail.com) Bug classification: NVIDIA driver bug in 570+ series, sm_100/sm_120 Verified: RTX 5070 Ti (sm_120) and RTX 3090 Ti (sm_86), CUDA toolkit 12.8+ Co-authored-by: blair <aggressive.lighthacker@gmail.com>
hjotha
pushed a commit
to hjotha/beellama.cpp
that referenced
this pull request
Sep 18, 2026
…sing, J_MAX validation, split-state init)
hjotha
pushed a commit
to hjotha/beellama.cpp
that referenced
this pull request
Sep 18, 2026
hip: shared perf (MMQ MoE tiles + mmvdq, prefill plumbing)
pwilkin
pushed a commit
to pwilkin/llama.cpp
that referenced
this pull request
Oct 8, 2026
Revert "server : add --cache-disk for a persistent prompt cache" (ggml-org#81)
bong-water-water-bong
referenced
this pull request
in 1bit-MONSTER/llama.cpp
Oct 24, 2026
## Motivation Fixes required to bump [`hrx-graph-develop-v2`](https://github.com/AMD-Ecosystem/llama.cpp/tree/hrx-graph-develop-v2) up to hrx-system: ROCm/hrx-system@5f4dfc8. Decode attention writes F32 results into global memory, then Q8 packing reads values written by other lanes. The intervening barrier fenced workgroup memory only. Fence global memory before packing in both reduction paths to prevent stale values from producing nonfinite Q8 scales and NaN perplexity. This appears to be a pre-existing llama.cpp synchronization bug, not a newly introduced HRX regression. The previous green PR105 package uses the same llama.cpp revision and older HRX `4341b71`; it also reproduces the failure locally. Newer HRX may have made the race more common by changing execution timing or generated code, but the controlled local comparison did not establish that: older and newer packages both produced NaNs in all ten alternating fresh-process repetitions. A second local comparison used the September 29 package from https://github.com/ROCm/ggml-staging-automation/actions/runs/36638317205, whose saved report explicitly passed this exact model and checksum with decode PPL 10.0045. That package (HRX `32b86d4`, llama.cpp `2ba2ddc`) and the current unfixed package each failed 10/10 alternating repetitions locally. Its llama.cpp revision differs, so this is a historical package comparison rather than an HRX-only comparison. Both old reduction paths already contain the same workgroup-only pre-packing barriers. Neither local comparison provides evidence of an increased failure rate with newer HRX. No introducing HRX commit is attributed. The HRX PR referenced by the fix commit documents the barrier API, not the introduction of this bug. ### Breaking changes | Breaking hrx-system PR | Fix | | --- | --- | | None identified; pre-existing llama.cpp race | AaronStGeorge@103a47d | ## Testing Tested in `ggml-staging-automation` full all-model CI with llama.cpp `103a47dd80e7` and hrx-system `5f4dfc8731a1`. - Bump PR: ROCm/ggml-staging-automation#108 - Full all-model CI: passed on strixhalo-10, https://github.com/ROCm/ggml-staging-automation/actions/runs/39701697708, staging head `1bad5e0d6acb`. The release benchmark and security checks passed. Llama-3.2-1B-Instruct decode PPL was 10.0408 +/- 1.32270; prefill PPL was 14.4414 +/- 0.45819. Both numerical checks and Vulkan references passed. The staging workflow supplies missing GPU device groups on canary runners and launches benchmarks with refreshed membership; no model expectations were changed. - Focused numerical validation: https://github.com/ROCm/ggml-staging-automation/actions/runs/39519720454. On DT241, DT243, and strixhalo-10, the original package failed 5/5 repetitions per host and the fix passed 5/5. Fixed decode PPL was 10.0408 +/- 1.32270; prefill PPL was 14.4414 +/- 0.45819. Vulkan reference checks passed. The run was red because DT245 could not initialize either package; it produced no model measurements. - Local CPU decode reference: 10.0388 +/- 1.32349. All 37 existing attention tests passed. - Compatibility floor remains `771711d49befd397f10c3c6deb66f1c5c89e5042`. Rebuilt HRX, Loom, the backend, and embedded kernel bytecode at that floor and ran the same fixed decode command successfully: PPL 10.0408 +/- 1.32270. - Reproduction command: `ROCR_VISIBLE_DEVICES=0 llama-perplexity -m Llama-3.2-1B-Instruct-UD-Q4_K_XL.gguf -f wiki.test.raw -c 512 --chunks 2 -b 512 -ub 1 --device HRX0` on gfx1151. Model and corpus are the pinned, checksum-verified inputs in the staging manifest. Device initialization hangs are separate from this numerical fix. DT239's captured stacks block in ROCr `BlitKernel::SubmitLinearCopyCommand` during HRX device-library initialization with both packages, even with Vulkan disabled, before any model executes. The underlying cause of that runtime hang is unresolved. Historical endpoint search for a llama.cpp frequency bisect: the September 7 package cannot execute this model's Q5_K matrix multiplication; September 16 produces PPL 41875.0725; September 23 produces NaNs. None is a locally correct good endpoint. Source history places the workgroup-only pre-packing barriers in `f43c5b4d9` (August 28), the initial Llama support change. This is source-history attribution of the missing fence, not a completed runtime bisect or proof of a later frequency increase.
jammm
pushed a commit
to jammm/llama.cpp
that referenced
this pull request
Nov 5, 2026
## Overview Fence global F32 stores before the fused Qwen MoE normalization kernel reloads them for Q8 packing. Producer and packer workitems own different channel ranges; the existing workgroup-memory barrier does not order their global-memory accesses. This follows the same fix used for decode attention in ggml-org#154. The change replaces one barrier memory domain and documents why. It preserves the existing arithmetic and 32-byte LDS allocation. ## Validation On RX 7900 XTX (gfx1100), HRX `82214df`, upstream base `930e43fe9`, flash attention and F16 KV: - The retained model-trace checker fails on original captures and passes on six fresh fence-only captures. All 80 Q8 groups match canonical packing and repeat identically. The model-specific harness is retained as investigation evidence, outside this PR. - Qwen3-Coder 30B-A3B Q4_K_M full WikiText-2: 146 chunks, 149,358 scored tokens, 49/49 GPU layers. HRX PPL **8.1441 ± 0.06075**; Vulkan **8.1470 ± 0.06078**. All 146 printed HRX cumulative rows equal the previously validated shared-memory candidate. - Same-window five-repeat median pp256: fence **3589.39**, shared-memory candidate **3589.78** tok/s (-0.011%). Median tg128: **223.994** vs **223.642** tok/s (+0.157%). - Qwen3-30B shared-consumer smoke: two-token prompt exercised the Q8 wrapper, twelve-token prompt exercised the F32 wrapper; each produced identical greedy output for two HRX runs and Vulkan. A separate one-token decode path did not select the changed wrapper and produced differing text; that result is excluded from the wrapper validation claim and remains unresolved. - Fence LDS **32 B**, versus **8,224 B** for the shared-memory candidate; SGPR24/VGPR54 for both. ## Requirements - Contributing guidelines have been read by the agent; human review and acceptance remain pending for this draft. - AI usage disclosure: YES — Codex assisted with implementation, review, validation, and this PR description. Submitted as a draft for human review.
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.


As suggested in #146 we are able to save lots of memory by using float16 instead of float32. I implemented the suggested changes, and tested with the 7B and 13B models, and there were no issues on my Intel-based MacBook Pro.
Merging these changes should allow more models to run more performantly on a wider range of hardware.