Repository navigation
Merge ggml-org/llama.cpp master f8caa5ea3 - #130
Merged
Merged
Conversation
* hexagon: add SSM_SCAN Op support * hex-ssm-scan: fix multi-device spliting * hex-ssm-scan: remove redundant checks and make kernel use host config * hex-ssm-scan: remove direct ddr access * hex-ssm-scan: remove DMA ordering * hex-ops: update supported ops * hex-ssm-scan: rewrite the dma pipeline to match other ops (dbl.buf, etc) * hex-ssm-scan: remove all fallbacks, only dma/vtcm paths * hex-ssm-scan: add kernel_type to kparams and remove redundant recomputes * hex-ssm-scan: avoid stalls in the overall pipeline (dma flush between chunks) * hex-ssm-scan: vectorize softplus * hex-ssm-scan: optimize hvx loops * hex-ssm-scan: add HMX support * hex-ssm-scan: add support for GGML_HEXAGON_SSM_SELECT * hex-ssm-scan: cleanup kernel names * hex-ssm-scan: simplify mdev checks * hex-mdev: improve mdev row-split solver --------- Co-authored-by: Max Krasnyansky <maxk@qti.qualcomm.com>
* ggml-hexagon: IQ2_XXS and NVFP4 tiled repack layouts * ggml-hexagon: IQ2_XXS HVX matmul kernel * ggml-hexagon: NVFP4 HVX matmul kernel * ggml-hexagon: NVFP4 per-tensor scale * ggml-hexagon: HMX paths for IQ2_XXS and NVFP4 * ggml-hexagon: supports_op coverage for NVFP4 and IQ2_XXS * fix HMX IQ2_XXS dequant scale underflow in fp16 * hexagon: IQ2_XXS 2-gather tile decode with compact grid, small-weight tests * IQ2_XXS vpopcount sign parity and gather pipelining * pipeline IQ2_XXS HMX dequant gathers and add large_w tests * hex-iq2-xxs: rebase and cleanup Remove unused helper functions. Add lut_size to the overall vtcm required size. Trim down (way way down) the new tests. * hex-iq2-xxs: actually trim down the tests --------- Co-authored-by: Max Krasnyansky <maxk@qti.qualcomm.com>
…l-org#32016) * dflash : move the DSpark markov head and backbone graphs to dspark.cpp Move-only: build_dspark_markov_head, graph_dsv4, graph_dsv41 and graph_mistral_large4 move verbatim. build_inp_target_features and build_dspark_markov_head become static members of llama_model_dflash so both files can use them. * dflash : detect the head and the backbone once, split the loaders per file load_arch_hparams sets llama_model_dflash::variant (DFlash, DFlash2, DSpark, LiliCorr) and ::backbone (base, DSV4, DSV4.1, Mistral Large 4). The head, backbone and base layer loaders become member helpers in dflash.cpp, dflash2.cpp, lilicorr.cpp and dspark.cpp. build_arch_graph dispatches on the backbone. The DFlash2 and LiliCorr loaders create the DFlash2 conv tensors through a helper in dflash2.cpp, right after their head tensors instead of in the base layer loop; the other tensors keep their creation order. The DFlash2 loader drops its copy of the conv group size check, which master never reached. * dflash : share the injection input, token embeddings and lm head lookups build_inject_inp (target features + fc + encoder norm), get_tok_embd and get_lm_head replace the copies in the base, DSV4, DSV4.1 and Mistral Large 4 graphs. build_inp_target_features is file-static again. * dflash : split the DFlash decoder into a graph per head graph_base creates the shared inputs and provides build_inject, build_inp_tokens, build_layers and build_logits. graph_dflash (dflash.cpp), graph_dflash2 (dflash2.cpp), graph_dspark (dspark.cpp) and graph_lilicorr (lilicorr.cpp) assemble them and add their head; the selector, scorer and markov head builders move to the file of their graph, and the DFlash2 local conv run by build_layers to dflash2.cpp. build_arch_graph dispatches on the backbone, then on the head. The op order and the tensor names are unchanged. * speculative : split the DFlash driver into a class per head common_speculative_impl_draft_dflash stays the DFlash implementation and becomes the base of draft_dspark, draft_dflash2 and draft_lilicorr. Its protected constructor only reads the draft metadata; init() then sets up the contexts with the options of the draft (draft length, backend sampling, device features, masked h_nextn). Each derived class overrides draft() with the path of its head from the former draft(). DFlash2 also overrides begin() to reseed its generator per request, and LiliCorr overrides process() to store the context features of each injected chunk, which its noise block carries as its state. The factory keeps the current routing: draft-dspark picks DSpark, draft-dflash picks DFlash2 or LiliCorr from the draft metadata and DFlash otherwise. draft-dspark with a DFlash2 or LiliCorr draft now runs the DSpark reader instead of a mix of both. sample_from_anchor is logged by DSpark only. * speculative : add the draft-dflash2 and draft-lilicorr types draft-dflash2 and draft-lilicorr name the DFlash2 and LiliCorr drafts, which draft-dflash keeps running too: it picks them from the draft metadata. draft-dflash2 and draft-lilicorr must match the draft model, draft-dspark rejects a DFlash2 or LiliCorr draft, a model that is not a DFlash draft is rejected, and a run uses at most one DFlash family type; these errors leave speculative decoding uninitialized. The type detected from the draft GGUF is now the concrete one, and draft-dflash2 and draft-lilicorr download the dflash sidecar. * docs : describe the DFlash2 and LiliCorr drafts Add the DFlash2 and LiliCorr sections and the new types, and explain that draft-dflash also runs DFlash2 and LiliCorr drafts. * speculative : drop the unused DFlash is_mrope Nothing reads it since the migration to common_batch (ggml-org#29385), which picks the number of M-RoPE position rows from the rope type of the draft. * doc: update spec dec * address review comments
Assisted-by: Claude Opus 5
* jinja : reduce value allocation and lookup overhead Assisted-by: GPT-6 Astra * jinja : address rendering review feedback Assisted-by: GPT-6 Astra * jinja : test multipart strings and simplify lookup Assisted-by: GPT-6 Astra * fix "undefined hint" * fix divisibleby 0 * clean up --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
* mtmd : allow custom video decoder * also adapt to wllama requirements * clean up * add test --------- Co-authored-by: Xuan Son Nguyen <son@huggingface.co>
* convert : require matcher to check backbone definition (model_type) in config.json Fixes ggml-org#32152 * Revert the modified llama_test_cmd_entry. --------- Co-authored-by: Jonathan Buck <jonabuck@amazon.com>
…gml-org#32237) Signed-off-by: Matt Rutkowski <mrutkows@us.ibm.com>
The qwen2vl graph passed NULL for the ffn_up/gate/down scales, so the per-tensor NVFP4 scales loaded by the generic pass were never applied and the model produced garbage (PPL ~1e6 on CUDA, NaN on CPU). Pass the scales to build_ffn like qwen2 does. Fixes ggml-org#32101
The thought channel is normally closed with <channel|>, but the model may open it and go straight to a tool call without closing it. Stop the reasoning at <channel|> OR <|tool_call>, so an unclosed thought does not swallow the following tool call. Fixes: ggml-org#32231 Assisted-by: Qwen 3.8 27b
…d dst, batched group_norm and bf16 sigmoid (ggml-org#32251) * opencl: fix q4_K mv oob read Assisted-by: Codex * opencl: fix kernel dispatch and oob writes for f16 swiglu_oai Assisted-by: Codex * opencl: fix the row broadcast for add/mul Assisted-by: Codex * opencl: respect destination tensor strides for cpy Assisted-by: Codex * opencl: handle batches in ne3 for group_norm Assisted-by: Codex * opencl: avoid double rounding for bf16 sigmoid Assisted-by: Codex
…gml-org#32282) Change dump()->dump_impl() calls to avoid infinite recursion.
…-org#32271) * chat: allow tool calls inside reasoning blocks for Ministral-3 and Qwen3 Fixes ggml-org#29248 Fixes ggml-org#20837 * chat: address review feedback for Ministral-3 reasoning end - Remove <function= from Qwen3 (intentionally not used outside outdated coder models) - Ministral-3: use choice between [/THINK] and peek([TOOL_CALLS]) instead of optional * chat: add [TOOL_CALLS] to Ministral-3 thinking_end_tags * chat: simplify Ministral-3 reasoning end choice * chat: restore peek lookahead for Ministral-3 tool call start * chat: keep [TOOL_CALLS] only in parser, not in thinking_end_tags * cont : revert tool call tag removal and update tests --------- Co-authored-by: Alen Požun <kukirin-ui@users.noreply.github.com> Co-authored-by: Alde Rojas <hello@alde.dev>
…g#32164) * chat : honor OpenAI tool strict flag in LFM2 tool-call grammar * chat : drop strict, always allow undeclared LFM2 tool calls
* vulkan: optimize matrix multiplication for narrow N Add new "narrow" tile configs for coopmat1/coopmat2 that are tuned for N<=32. * Attempt to handle wave64 * add n=16 tile for cm1 * apply RDNA split_k heuristic to narrow_n generally --------- Co-authored-by: Ruben Ortlam <rortlam@redhat.com>
ggml-org#31323) * vulkan: optimize Flash Attention cm1 for RDNA3 and RDNA4 * reduce shmem use through buffer reuse * clean up and fixes * limit q_in_regs to prefill * vulkan: add flipped FA path, each subgroup owns 16 Q rows * cleanup * move flip shader into own file * replace kvsep with direct load mode * fix nvidia hang, tune AMD * only store pv in sfsh if necessary * fix skip condition * nvidia tuning * reduce occupancy on RDNA4 for large attention head sizes * fix sparse FA fp16 underflow bug
* vulkan: Explicitly include SPIRV-Headers Distros that don't put the headers in a system include path need to specify it to the compiler. So we use the appropriate CMake target to include it. Assisted-by: Codex * vulkan: Add explicit headers location to workaround OSX CI runner conf
…gml-org#31438) * llama : allocate the tensor staging buffer from the CPU buffer type * llama : drop the staging buffer test, reword the comment
Signed-off-by: Aaron Teo <aaron.teo1@ibm.com>
Assisted-by: Grok Bot
) * metal: add a tensor API conv_2d kernel and split long reductions The conv_2d matmul kernel runs on simdgroup matrices only, and gives each threadgroup the whole reduction of its output tile. On M5 this leaves the tensor cores unused, and convolutions with few output positions and a long reduction (IC * KW * KH in the thousands) run a handful of threadgroups on an otherwise idle GPU. Add kernel_conv_2d_mm_tensor for devices with the tensor API: like kernel_mul_mm, it gathers the patches of 64 output positions into threadgroup memory as the left operand and reads the kernel rows from device memory as the right operand. Devices without the tensor API keep the simdgroup kernel. Both kernels can now split the reduction until there are enough threadgroups: each split writes its partial sums to a buffer placed after the output, as flash attention does, and a small kernel adds them in a fixed order, so the result stays deterministic. CONV_2D is marked as an op whose allocation may exceed its output size. test-backend-ops -o CONV_2D passes, with and without GGML_METAL_TENSOR_DISABLE. CONV_2D, F16 kernel, us/run on an M5 Max: [19,19,256,16] k [4,4,256,4096] 19008 -> 5235 [16,16,128,8] k [3,3,128,512] 333 -> 124 [1536,1536,32,1] k [3,3,32,64] 12086 -> 6512 [33,1,1280,1] k [3,1,1280,1280] s2 659 -> 33 [2054,1,768,1] k [7,1,768,768] 3161 -> 699 * metal: walk the conv_2d patches incrementally, size splits by output The patch gather of both conv_2d matmul kernels spent most of its time on address math: 64-bit multiplies, divisions and four bound checks per value. Walk the reduction index with 32-bit byte offsets inside the image, updated by additions, with one unsigned compare per bound; the host checks that an image fits. The tensor kernel no longer gathers the reduction indices past the end of its split. The number of splits now targets about 1M partial sums, with at least 3 reduction steps per split, instead of counting the tiles of one kernel. CONV_2D, F16 kernel, us/run on an M5 Max: [19,19,256,16] k [4,4,256,4096] 4998 -> 4512 [1536,1536,32,1] k [3,3,32,64] 6721 -> 5354 [4096,1,1024,1] k [7,1,1024,1024] 2701 -> 2236 [2054,1,768,1] k [7,1,768,768] 1050 -> 871 with GGML_METAL_TENSOR_DISABLE: [4096,1,1024,1] k [7,1,1024,1024] 9047 -> 8283 * nit: share the CONV_2D simdgroup count between host and kernel kernel_conv_2d_mm and its pipeline both hardcoded 4 simdgroups per threadgroup. N_SG_CONV_2D in ggml-metal-impl.h now feeds the kernel constant and res.nsg, so the dispatch and the kernel cannot drift apart. * metal: fall back to the generic conv_2d kernel for images past 4 GiB The matmul conv_2d kernels walk the patches with 32-bit byte offsets inside an image. Instead of asserting on nb13, compute the largest offset actually read from ne/nb, which also covers strided views of the input, and route images that do not fit to the generic kernel. * cont : comments Co-authored-by: Georgi Gerganov <ggerganov@gmail.com> --------- Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
llm_graph_params no longer carries hparams, prec_policy and hdmd, since the model reference already provides them. llm_graph_context sources them from the model and keeps prec_policy as a reference. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB)
* Shader, pipeline, and launcher * Update docs and add newline to wgsl * Formatting fixes
176 commits of ggml-org master (2026-11-13 .. 2026-11-19). Conflicts were resolved toward the ggml-org code, with the RDNA3 parts re-applied on top: - common/speculative.cpp: ggml-org split DFlash into DFlash / DSpark / DFlash2 / LiliCorr classes. Their code is taken as is; the per-sequence p_min (no probability cut when several slots draft together) is applied in the draft of each class, the batched feature injection stays in the base class. - mmq-few.cu, quantize.cu/.cuh: the few-row MMQ for MUL_MAT_ID of ggml-org is kept next to the RDNA3 WMMA path. The WMMA kernel has no MUL_MAT_ID variant, so on RDNA3 MUL_MAT_ID does not take the few-row path (as before). The WMMA q8_1 store is a helper beside the ggml-org store helper. - ggml-cuda.cu, norm.cu: NORM + MUL (+ ADD) fusion of ggml-org kept verbatim, together with the RMS_NORM + MUL + ADD + MUL fusion. - fattn-tile.cuh, fattn-vec.cuh: mask head dimension of ggml-org together with the K/V rows of the fork. - llama-kv-cache.cpp: seq_rm of the cells of ggml-org, which does the same as the fork's version. - llama-context.cpp: both environment options. ggml-org now uses the native ROCm warp sync builtins, which need 64-bit masks: the shuffles in norm.cu and top-k.cu use ggml_cuda_shfl_xor. Assisted-by: Claude Opus 5.5
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.
176 commits of ggml-org master (2026-11-13 .. 2026-11-19). Conflicts were
resolved toward the ggml-org code, with the RDNA3 parts re-applied on top:
DFlash2 / LiliCorr classes. Their code is taken as is; the per-sequence
p_min (no probability cut when several slots draft together) is applied
in the draft of each class, the batched feature injection stays in the
base class.
ggml-org is kept next to the RDNA3 WMMA path. The WMMA kernel has no
MUL_MAT_ID variant, so on RDNA3 MUL_MAT_ID does not take the few-row
path (as before). The WMMA q8_1 store is a helper beside the ggml-org
store helper.
verbatim, together with the RMS_NORM + MUL + ADD + MUL fusion.
with the K/V rows of the fork.
as the fork's version.
ggml-org now uses the native ROCm warp sync builtins, which need 64-bit
masks: the shuffles in norm.cu and top-k.cu use ggml_cuda_shfl_xor.
Checked: syntax-only compile (host and gfx1100 device) of every file with a resolved conflict plus top-k.cu; no full build, no test-backend-ops, no benchmark yet.