Repository navigation
Conversation
The batch offsets from ggml_batch_offset are in bytes, but the F16 tinygemm launch added them to float/fp16 pointers, and the quantized paths added the dst offset to a float pointer. Every batch after the first read and wrote 2-4x too far, out of bounds, so batched matmuls with 3D weights in the AMX buffer (per-head MLA k_b / v_b in F16) returned garbage past the first head. F16 weights are stored in the AMX buffer unconverted. When the kernels cannot take a shape (e.g. a permuted src1 with more than one token), let the regular CPU matmul run it instead of declining, which left the node with no backend and aborted in ggml_backend_sched_split_graph.
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.
What
Two fixes in the CPU AMX extra buffer (x86 with AMX,
GGML_NATIVE=ON).ggml_batch_offsetreturns bytes, but the F16 tinygemm launch added it tofloat */ggml_fp16_t *pointers, and the quantized paths added the dst offset to afloat *. Every batch after the first read and wrote 2-4x too far (out of bounds). Batched matmuls with a 3D weight in the AMX buffer, such as per-head MLAk_b/v_bin F16, came out wrong past the first head.src1with more than one token, the AMX buffer declined the op. The CPU backend then also declined it, so the node had no backend andggml_backend_sched_split_graphaborted onGGML_ASSERT(*cur_backend_id != -1). The AMX buffer now accepts those F16 cases and returns no tensor traits for them, so the regular CPU matmul runs them. Quantized weights are converted at load and keep the old behaviour.Upstream master has the same code.
Measured (Xeon with AMX, CPU only, an MLA model whose draft layer has F16
k_b/v_b)n_ubatch32. Atn_ubatch1 its logits had 0/23 top-1 agreement withuse_extra_bufts = false, and a max logit gap of 14.9.n_ubatch32 runs. Againstuse_extra_bufts = false, top-1 agreement is 21/23 (ubatch 1) and 20/23 (ubatch 32), with a max logit gap of about 2.0. Node sums along the graph agree within 1.8e-3 relative; the attention part agrees within 6e-5.Not covered