Repository navigation
Merge ggml-org/llama.cpp master e5cd6e34c - #138
Merged
Merged
Conversation
…each a file/bpw target size at lowest error (ggml-org#15550) * Refactor pareto optimise and convexify * Refactor lagrange_penalty() * Refactor quantisation checks into its own function * Exit loop if no better solution found * Replace slope with cross product * Adjust for small vector size * Simplify candidates sorting * Add comments to explain magic numbers * Increase scale multiplier * Move is_iq() into a lambda and remove unused variables * Combine quant types * Reduce bpw range * Refactor outlier trimming * Tighten worker allocator * Check for direction reversal * Simplify dequantisation * Calculate bpw over all tensors * Compute rows based on tensor shape and slice count * Prioritise important tensors * Select quantization type if target_bpw is set unless user specifies type and threads * Relax lambda clamping * Add signal handler * Add save_bpw_state() * Add load_bpw_state() * Add delete_bpw_state() * Persist progress * Uninstall signal handler and cleanup * Fix trimming logic * Generate model ID hash * Remove bias mode computation * Remove --no-bias option * Automatically determine if bias error is significant * Reduce compute time by parallelising tensor processing - courtesy of https://github.com/ddh0 * Add quant types * Add --keep-bpw-state option * Refactor signal handlers * Update quant types * Minor refactoring * Add tensor type and depth heuristics * Add option to override bpw state file name * Minor refactoring * Finetune heuristics * Update usage * Fix lambda capture * Update epsilon specifier * Finetune heuristics * Simplify tensor selection * Read statistics from imatrix * Add Euclidean-Cosine score to identify important tensors * Improved is_important() logic * Fix lambda capture bug in Windows and initialise candidate_types struct * Remove processing statistics_data * Add --disable-tensor-importance option * Use more descriptive option naming * Relax target bpw range * Increase importance boost for final pass * Add B/F16 to get_ftype() * Process bpw targets up to B/F16 * Improve state checkpoint filename * Add code comments * Update usage() * Update README.md * Change checkpoint file magic * Prepare for future optimization algorithms * Add parse_target_size() * Add --target-size option * Implement target_size logic * Update usage() * Refactor parameter names * Refactor option names * Update parameter names * Improve file handling * Remove file deletion * Refactor variable names * Update usage() * Add use_wce option * Read statistics_data from imatrix * Add experimental entropy-modulated weighted cosine error (WCE) * Performance optimisations (AI assisted) * Memory optimisations (AI assisted) * Update output log * Fix state file name generation and simplify_pareto() lambda capture * Change tensor importance score logic * Refactor is_quantizable() * Improve WCE to be magnitude-aware * Expected Output Error MSE * Fix scale factor overwrite bug * Test removing unused headers * Remove wce flag * Angle-aware/Magnitude-aware (MSE/WCE) hybrid error estimation * Revert to weighted cosine error estimation * Enhanced scaling factor * Use centered‑normalized importance scaling factor (CNIF) * Remove redundant logs * Improve state file handling * Update usage instructions * Update ftype parsing logic * Flag experimental features subject to future removal * Fix --target-size description * Fix "casts away qualifiers" compiler warning * Exclude user defined tensors (--tensor-type) from the Lagrangian optimization (courtesy of https://github.com/AesSedai) * TurboQuant bias factor for inner-product sensitive tensors * TurboQuant outlier mitigation * Refactor TurboQuant improvements * Fix remap tensor bug * Remove --importance-pct option * Refactor llama_model_quantize_params to expose a pure C interface * Consolidate load/save process and remove --save-state flag * Minor log output changes * Use the tensor statistics' schema * Add quant types * Release finished tensors mmap allocation * Reuse sample buffers * Fix C2327 error when target compilation is a MS platform * Minor refactoring and AI assisted optimizations * Add uv.lock * Minor refactoring and AI assisted optimizations * Add Halko, Martinsson & Tropp randomized SVD condition number estimator * Add kappa squashing functio * Remove unnecessary includes * Add required include * Update python dependencies * Fine-tune kappa mapping parameters * Fine-tune CNIF beta parameters * Fix fallback counter error * Move to libllama and unmap weights offloaded to backend * Remove unmap weights offloaded to backend * Add winsorization * Add adaptive tensor boosting * Minor cosmetic changes * Refactor processing of unused kv tensors * Minor cosmetic change * Implement --max-buffer-size in target_bpw_type() * Fix 32-block fallback case * tensor_type_override_for() DRY refactoring * Fix typo and remove unused option * Fix ggml-org#28491 linking bug when compiling with BUILD_SHARED_LIBS=OFF * Remove GGML_USE_METAL conditional macro and let the optimizer decide\ * Add --target-exclude * Remove and ignore uv.lock * Fix pinned tensors safety limits calculation * Fix truncation error * Add downwards greedy upgrade * Add target bpw/size tests * Guard imatrix schema * Update --target-bpw/size descriptions and README.md * Harden state checkpoint's file operations * Link model and imatrix to state checkpoint * Enforce and consume stats schema data * Add stats schema tests * Refactor signal handlers out of lib and harden the logic * Improve handling of pinned tensors * Add tests * Add include to keep ubuntu-webgpu happy * Moving new API entries to prevent brittle downstream apps failing * Fix miscellaneous issues
* compact bias on the existing FLASH_ATTN_EXT for CUDA, ROCm and Vulkan * fixup! compact bias on the existing FLASH_ATTN_EXT for CUDA, ROCm and Vulkan * remove the Vulkan support from this PR * move the CUDA/HIP and Inkling 2 graph changes out of this PR * CPU reference implementation of the indexed bias * move the indexed bias test to test-backend-ops, add the bias in F32 on CPU * incorporate review remarks
) * metal : batch concat rows and copy them in vector chunks The concat kernel copied one element per thread, so wide rows with many rows ran at a fraction of the memory bandwidth. Batch several rows per threadgroup and copy the contiguous dim-0 elements in 4-element chunks when the row is contiguous. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * test : cover concat vector and misaligned row paths Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB) * metal : hoist the concat src1 row offset into scalars Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB) * metal : peel to align the concat vector copy Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB) * metal : vectorize concat rows along any dimension Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB) * metal : specialize concat with function constants Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB) * metal : drop the concat row-batch dispatch Batching several rows per threadgroup reduces the number of threads by the batch factor. On machines with a large GPU this leaves too few requests in flight and the copy becomes latency bound: M5 Ultra (36 CPU) f16 [1024,8,256,1] d=0 8.1 us -> 17.2 us f32 [4096,8,256,1] d=0 35.4 us -> 118.5 us f16 [4096,8,256,1] d=2 50.9 us -> 102.0 us An interleaved sweep of the (nth, nrptg) dispatch over the concat perf cases on an M2 Ultra and an M5 Ultra shows that the base dispatch is best or tied for every shape once the rows are vectorized, and that the gains of the previous commit come from the vector copy alone: M2 Ultra f16 [1024,8,256,1] d=0 32.4 us -> 17.0 us M5 Ultra f16 [1024,8,256,1] d=0 13.3 us -> 8.1 us Keep the vector copy and the function-constant specialization, and return to the original dispatch. Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB) * metal : revert the concat function constants Specializing the concat kernel on the concat dimension and on whether a row is split across threadgroups with function constants makes the strided scalar path slower. Interleaved over the concat perf cases on an M5 Ultra, the specialized kernel is not faster than the plain one, and it costs up to 18% on shapes that are already at the memory bandwidth limit: f32 [2050,8,256,1] b=255 d=0 21.0 us -> 25.1 us f32 [2050,8,256,1] b=256 d=2 31.1 us -> 36.7 us f16 [4096,8,256,1] b=256 d=2 31.2 us -> 36.7 us Revert the specialization and keep copying rows with the runtime arguments. The concat change is now limited to the kernel itself. Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB)
* metal : add NVFP4 support Follow the MXFP4 path: add the UE4M3 scale decode, the NVFP4 dequantizers, a dedicated mat-vec kernel with its MUL_MAT_ID, small-batch and MMA variants, the mul_mm / mul_mm_id and tensor-op variants, and the get_rows and cpy kernels. Enable the type in supports_op. Tested on an M5 Max with ggml-org/NVIDIA-Nemotron-3.5-Lightning-30B-A3B-GGUF:NVFP4 and test-backend-ops (MUL_MAT, MUL_MAT_ID, W4A8/W4A4, CPY, GET_ROWS). Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (2x DGX Spark (RDMA, TP=2)) * metal : skip the small-batch path for NVFP4 With the few-row MMA kernels covering ne11 3..16, the small-batch mat-vec kernels are only reachable at ne11 = 2, where they are 17-59% slower than the generic mat-vec kernel on an M2 Ultra and an M5 Max. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (2x DGX Spark (RDMA, TP=2))
…2906) Paper is now the only light theme: its surface tokens stay the base values, and the theme-matte overrides, the setting, its enum and the Storybook surface switch are gone. Assisted-by: Claude (Opus 5.5 Medium)
…Windows on Snapdragon (ggml-org#31759) * opencl: fetch the Adreno binary kernel library at configure time Make GGML_OPENCL_USE_ADRENO_BIN_KERNELS an option, default ON, and add GGML_OPENCL_ADRENO_BIN_KERNELS_FETCH, default ON. On Windows, CMake downloads the pinned adreno-opencl-kernels release from the Qualcomm Software Center, verifies its SHA256, and copies the DLL and its license next to the executables. A failed download is only a warning; the backend then uses its builtin kernels. The opencl-adreno release job turns the fetch off, since it ships only ggml-opencl.dll. * opencl: fetch the Adreno binary kernel library only on ARM64 The library is built for Windows on ARM64 only. * opencl: add download timeout and better handle output dir Assisted-by: Codex * opencl: add .txt to license file Assisted-by: Codex --------- Co-authored-by: Li He <lih@qti.qualcomm.com>
…rg#32828) Assisted-by: Codex
* GDN: use replay instead of rollback [WIP] * memory : move rs_max with the sequence when find_slot swaps cells find_slot swapped pos/src/rs_pend/seq_id of the cell it moves out of the way, but not rs_max, so that sequence inherited the rollback depth of the cell's previous owner. A smaller value made seq_rm refuse the rollback (ggml-org#31656), a larger one made snapshot mode restore the previous owner's snapshots. With rs_replay the pending columns are copied along with the state, so rs_max follows the sequence. Without it only the final state is copied and the snapshots stay behind, so the moved sequence gets rs_max 0. * delta_net: drop the graph replay fallback The graph fallback ran the replay as two gdn ops and copied the committed state from the replay gdn when keep, from the main gdn otherwise. Backends whose graph_optimize reorders nodes (Metal, Vulkan) then give keep and non keep ubatches a different node order for the same node count, and the scheduler reallocates on every switch (abort under GGML_SCHED_DEBUG_REALLOC). The replay now always runs in the gdn op. A device without the replay in its gdn op leaves the op to the CPU through the scheduler, as for any unsupported op. This removes LLAMA_RS_REPLAY=2, the replay probe, rs_replay_fused and the rep_mask input. * metal: replay the pending gated delta net tokens in the kernel The gated delta net kernel replays the pending tokens of each seq before the new ones, with the same state update as the main loop and no attention output. With keep, it writes the state after the replay and skips the final state. The replay is a function constant of the pipeline, keep is a kernel argument as on CUDA. The pending buffers fall back to src0 when the op has no replay. * vulkan: replay the pending gated delta net tokens in the shader The gated delta net shader replays the pending tokens of each seq before the new ones, with the same state update as the main loop and no attention output. With keep, it writes the state after the replay and skips the final state. The replay is a specialization constant of the pipeline, keep is a push constant as on CUDA. The pending buffers bind q when the op has no replay. The result checker clones the op with its replay sources. * webgpu: replay the pending gated delta net tokens in the shader The gated delta net shader replays the pending tokens of each seq before the new ones, with the same state update as the main loop and no attention output. With keep, it writes the state after the replay and skips the final state. The replay is a define of the pipeline, keep is a param as on CUDA. The replay count goes through workgroupUniformLoad, so that the loop around the workgroup barriers stays uniform. * delta_net: share the replay conv window views across layers Each replay layer took its own view of the rs_rep_cols input. The scheduler copies every view of a host input as a separate split input, so a verify graph uploaded one copy per layer. The views of the delta net and the PLE conv windows are now built once per graph, like the s_copy views. * vulkan: clamp the gated delta net replay count to n_pend The replay count comes from a buffer, so the shader bounds it to the pending rows before looping over them. The pipeline array comment now names the replay index next to the other ones. Address review from 0cc4m. * hex-gdn: add support for replay Enable replay in HVX path Enable replay in HMX path * gdn: fix rebase conflicts (missing cparams, etc) * llama : drop the fused GDN probes brought back by the rebase il parameter of build_delta_net. The rebase kept them (unused, auto_fgdn was always false), so restore master's version of that code. * delta_net : replay for the KDA models and Clover-MoE Clover-MoE has the Qwen 3.5 layout and only needs the arch gate. Kimi K3, Kimi K3.1, GLM5-Next and BailingMoE3 keep the q, k and v conv windows one after the other in a row. With replay the row holds three channels-first histories [d_inner, window + pending]: build_conv_state_replay takes the gathered rows of the layer and the block index. The pending gate rows hold S_v gates per head (KDA). GLM5-Next gets the -sm tensor split rules for the replay rows. Tested with test-llama-archs models: logits match snapshots bit for bit with random rollbacks (CUDA, Vulkan, CPU), no graph re-plans, and test-llama-context passes in both modes. * cuda : same KDA update in the gated delta net main and replay loops The KDA main loop called expf(g) twice inline, the replay loop reads g from registers. On sm_89 nvcc fused the two loops differently, so a replayed state was a few ulp off the state of the first pass. Compute g into registers in the main loop too: replay matches snapshots bit for bit on sm_89, and the sm_120 output does not change. * opencl: support replay in GDN * llama : replay inputs for the hybrid iswa rel memory input build_inp_mem_hybrid_iswa_rel came in with the rebase: pass hparams and cparams to build_rs_inp_impl and fill the replay inputs in set_input, like the other hybrid inputs. * webgpu: keep the gated delta net replay within the storage buffer limit * delta_net : add ggml_gated_delta_net_ext, replay is the only rollback ggml_gated_delta_net_ext takes the optional replay inputs and always outputs one state. ggml_gated_delta_net(..., K) is back to its master signature and is deprecated; both build the same op, so the backends are unchanged. The delta-net models (qwen35, qwen35moe, qwen4exp, clover-moe and the KDA models) now always replay the kept tokens when n_rs_seq > 0. The LLAMA_RS_REPLAY env flag and the snapshot branch of build_recurrent_attn are removed. test-backend-ops drops the K > 1 snapshot cases and the K parameter of the gated delta net tests. The cache fusion test copies the single state. * ggml-cpu : spacemit: leave the gdn replay to the generic kernel The RVV gated delta net kernel does not read the replay inputs. Return false when op param 1 (n_pend) is set, so that the generic kernel runs the op. * vulkan : fill views at any offset ggml_vk_fill bound dst without allowing a misaligned offset, so a fill of a view whose offset is not a multiple of minStorageBufferOffsetAlignment aborted. The recurrent state zeroing in build_rs hits this with the wider replay conv rows on devices with a 64-byte alignment. Bind dst from the aligned offset below it and pass the element offset in KY. test_fill gets an offset to fill a view in place. --------- Co-authored-by: Pascal <admin@serveurperso.com> Co-authored-by: Max Krasnyansky <maxk@qti.qualcomm.com> Co-authored-by: Li He <lih@qti.qualcomm.com>
Assisted-by: Codex
* vulkan: support state size 96 in ssm_scan Assisted-by: Claude Code * vulkan: specialize ssm_scan state size Assisted-by: Codex * vulkan: clarify ssm_scan constant names Assisted-by: Codex
* metal : use a range-reduced log1p for softplus Use the atanh series for x in [-0.5, 1] and precise::log(1 + x) otherwise. This avoids the cancellation in log(1 + exp(x)) for negative inputs and does not rely on fast-math folding of (1 + e) - 1. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * tests : add a softplus test for negative inputs Use inputs in [-16.6, -16.0], where log(1 + exp(x)) has up to ~2x relative error. This catches both the old form and the fast-math-folded compensated form. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) * ggml : use log1pf in ggml_compute_softplus_f32 Use log1pf(expf(input)) so the host helper keeps the true value for x < -16.64. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) Co-authored-by: IsNot-10 <209144869@qq.com> * vulkan : use a range-reduced log1p for softplus Use the atanh series for x in [-0.5, 1] and log(1 + x) otherwise. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) Co-authored-by: IsNot-10 <209144869@qq.com> * opencl : use a range-reduced log1p for softplus Use the atanh series for x in [-0.5, 1] and log(1 + x) otherwise. Assisted-by: dsh:llama.cpp/ggml-org/DeepSeek-V4.1-Flash-1017-GGUF (Mac Studio, M5 Ultra, 256GB) Co-authored-by: IsNot-10 <209144869@qq.com> * vulkan : move log1p to utils.glsl Move the range-reduced log1p out of unary.comp into utils.glsl so that other ops such as topk_moe and ssm_scan can include it. The body is unchanged; only the call site in op_softplus is renamed. Co-authored-by: IsNot-10 <209144869@qq.com> Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (MacBook, M5 Max, 128GB) --------- Co-authored-by: IsNot-10 <209144869@qq.com>
…-org#32920) When the last assistant message came from a model that is no longer available, the submit button stayed red and disabled even after an available model was picked in the form, since availability checked the conversation's model first. The form's selection now decides it; the conversation's model only counts when nothing is selected. Assisted-by: Claude (Opus 5.5 Medium)
Assisted-by: Claude (Opus 5.5 Medium)
* server : fix skipped prompt cache lookups Assisted-by: Claude Opus 5 * server : let the slot scheduler ask the prompt cache Move the prompt cache lookup into server_slot_sched::select() so the plan alone decides whether the cache is updated, and the caller only applies it. find_better() and has_better() are now const, and find_better() also returns the common prefix, so load() no longer recomputes it. --------- Co-authored-by: Pascal <admin@serveurperso.com>
The dummy-model context sweep no longer fits within the job timeout on the llvmpipe runner. Exclude it from the ctest run there, keeping the coverage in the other jobs. Assisted-by: dsh:llama.cpp/ggml-org/Qwen3.8-Flash-Next-GGUF (RTX 5090 32GB, DDR5 128GB)
…ness (ggml-org#32927) * ui: add @ggml-org/llama-harness, the agentic loop as a package, in ui/lib/harness Llama Harness is the agentic loop as headless TypeScript with no UI, no DOM and no dependencies. It streams a turn, runs the tools the model called, gives it the results, and repeats until the model answers without a tool call. An app gives it an inference client and tools, and reads the run as a stream of events: run(messages, tools, signal). It ships a client for any OpenAI-compatible endpoint, so it also runs on its own in Node. The UI workflow type-checks, tests and packs it. Assisted-by: Claude (Fable 5.2) * ui: run Llama Chat's agentic loop through @ggml-org/llama-harness The loop leaves the agentic store, which now gives the harness what the app owns: ChatService as its inference client, the enabled tools behind the permission gate, and the callbacks that store each turn. Its API and the flow's callbacks are unchanged. A unit test runs the flow end to end with the server and the tools mocked. Chat compiles the harness from source through an alias, so the builds that copy or isolate ui/apps/chat now bring ui/lib/harness along: CMake and Nix through LLAMA_HARNESS_DIR, the Dockerfiles with a COPY. Assisted-by: Claude (Fable 5.2) * ui: bring the architecture docs in line with the ui/ folder The layout card no longer calls the move planned, the harness is in the pages, and they say that Llama Chat does not import @ggml-org/llama-ui yet. Assisted-by: Claude (Opus 5.5 Medium) * ui: phrase agent traces in @ggml-org/llama-harness The plain-language lines of an agent trace move out of Llama Chat into the harness, as a headless trace module any app on it can use: what one tool call did ("Read app.ts"), what it is doing now ("Running npm test", "Thinking"), what a run of calls did ("Ran 3 commands, read 2 files"), and how calls fold into one row with the reasoning around them. createTracePhraser knows llama-server's built-in tools. An app adds its own with resolvers and a phrasing table; any other tool reads as "Used <tool>" with its main argument, and a call with a description shows the model's own words. The lenient parse of streamed arguments and the targeted read of a path in a whole-file argument move with it. Llama Chat keeps its Svelte components and phrases only its own tools: the browser tools, web search and tool_search. Its functions keep their names and signatures, so nothing that renders a trace changes. Assisted-by: Claude (Opus 5.5 Medium)
* Only run webgpu CI on my fork * Add webgpu only workflow * resolve merge conflicts * add row check for softmax * add test * Add test to test case eval
Launch dequantize_block_nvfp4 with dim3(32, 8) so each CTA covers 8 NVFP4 blocks (256 values), as the K-quants do. Assisted-by: Claude Code Co-authored-by: plasmatixultra <plasmatixultra@users.noreply.github.com>
* vocab : avoid string allocations in BPE tokenization * whitespace-- --------- Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@huggingface.co>
…g#32897) * CUDA: reduce all cooperative softmax partials when nsm > 256 Fixes ggml-org#32852 * CUDA: drop the remaining cooperative softmax grid size assert
Assisted-by: Claude Opus 5.5
After collapsing contiguous dims, the stride of a trailing dim of size 1 becomes the size of the whole tensor. Its index is always 0, but the uint32 stride asserts still fire once the tensor has more than 2^32 elements, e.g. the per-head relative-position mask add of inkling2 at n_kv > ~87k with -ub 2048. Fixes ggml-org#32804 Assisted-by: Claude Opus 5.5
* fix building in symlinked directories My checkout is in a symlinked directory, so that the cmake CWD differs from its realpath: ``` $ echo $PWD /home/[READACTED]/llama.cpp $ realpath $PWD /data/home/[READACTED]/llama.cpp ``` The build here fails with this error: ``` CMake Error: Unable to read from file: ../../../../../../../../data/home/[READACTED]/llama.cpp/build/ui/apps/chat/dist/_app/immutable/assets/0.Cc4cGcci.css because: Can't lstat ../../../../../../../../data/home/[READACTED]/llama.cpp/build/ui/apps/chat/dist/_app/immutable/assets/0.Cc4cGcci.css CMake Error at /home/[REDACTED]/llama.cpp/scripts/ui-assets.cmake:229 (file): file failed to compress: /home/[REDACTED]/llama.cpp/build/ui/apps/chat/ui-gzip/_gzip/_app/immutable/assets/0.Cc4cGcci.css Call Stack (most recent call first): /home/[REDACTED]/llama.cpp/scripts/ui-assets.cmake:629 (emit_files) ``` This is because the cmake `emit_files` function uses relative paths and is inconsistent about its use of realpath. This commit fixes the build in my environment by switching from relative to absolute paths for the archive member files, so that the distinction between realpath and non-realpath doesn't mess things up. * refactor: Apply suggestion --------- Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com>
* opencl: refactor scale Assisted-by: Codex * opencl: add log Assisted-by: Codex * docs: update OpenCL operation support
…gml-org#33197) * vulkan : one thread per row for soft_max and sum_rows on short rows A row of at most 8 columns got a whole workgroup with a shared memory reduction. Each invocation now handles a whole row, with fastdiv for the row indices, and sum_rows covers mean through its weight. On 3.4M rows of 4 on an RTX PRO 6000, soft_max goes from 1653 to 42 us and sum_rows from 1662 to 10 us. Hy4 flash decode goes from 53 to 60 t/s at 4k context and from 9.6 to 54.8 t/s at 16k. * vulkan : initialize soft_max fastdiv push constants * vulkan : use vec4 loads in the short row soft_max and sum_rows Rows of 4 or 8 floats were read and written one element at a time, so each load of a subgroup hit addresses 16 or 32 bytes apart. When the row length is a multiple of 4 and the strides are aligned, move whole vec4 instead, and keep the scalar loop otherwise. On a RTX PRO 6000 with 3.44M rows of 4 floats, soft_max goes from 42 to 19 us and sum_rows/mean from 10.3 to 9.5 us. * tests : remove the temporary short row cases * vulkan : revert the vec4 loads in the short row soft_max and sum_rows The vec4 path halves the soft_max kernel time on rows of 4 floats, but Hy4 flash decode is unchanged on a RTX PRO 6000 and sum_rows gets slower with 8 floats per row, so keep the simpler scalar loop.
Upstream implementation of Inkling 2 CUDA fusions, FA indexed bias and topk-moe weight-norm bias replaces the fork's equivalents; RDNA3 tuning kept and re-ported onto the moved fusion code.
…FP4, no sparse tile instances for quantized K/V Assisted-by: Claude Sonnet 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.
274 commits of ggml-org master (2026-11-22 .. 2026-12-01, up to e5cd6e34c). Includes the maskless MMA flash attention for RDNA (upstream PR 32930) and the HIP CU_CHECK/VMM loop fix (upstream PR 33227); both are in the merged tree.
Status: left OPEN on purpose. Build and test-backend-ops pass, but the production presets could not be benchmarked (see below), and the Inkling 2 path changed implementation.
Resolution notes
Taken from upstream, fork code dropped:
ggml_flash_attn_ext_set_bias, F32 bias only, upstream PR 33063/33178), CPU indexed bias, all non-CUDA backend support checks. Fork commits made obsolete: 79980c5 8c6f0c0 2d2e833 977a600 1cd2adc cc46885 4d47667 f644083 fc01285 a72d05b 91c1855 and the fork Inkling DSpark commits.build_rs_in_placeis a thin wrapper over upstream's in-placebuild_rs.Kept from the fork and re-ported onto the moved fusion code (ggml-cuda.cu -> fusion.cu): q8_1 copy fusions (rms_norm, unary+mul, ssm_conv, concat+state, mul-row, combine), shared-expert tails, delta-net gate pair, MoE compact ids / F16 gemm-input / q8_1 caches, hipCUB argsort, MMQ-vs-gemm choice by matrix size (now excluded for NVFP4, which has no dequant path), mmvq/mmvf tuning, LLAMA_SCHED_PER_SIZE, per-sequence draft p-min, multi-sequence DFlash feature injection, kv-cache / graph reuse fixes, busy-prompt cap.
FA (fattn-*.cuh): upstream structure, fork RDNA3 work re-ported: K/V rows kernel on RDNA3 (indexed loads kept on for AMD WMMA), q8_0/q4_0 direct K/V read in the tile kernel (sparse tile instances excluded for quantized K/V), head 512 WMMA, head 256 tile tuning, masked-row independence fix.
Known losses: few-row MMQ for Q8_0 at 17-24 columns (upstream kernel has one 16-column group) now goes to regular MMQ; Q8_0 9-16 columns and gfx1100 start at 7 columns kept.
Checks (gfx1100, ROCm 10.1)
Bench (llama-bench, f16 KV, new = this branch, old = fork master dad3d43 tree)
Production shares the GPU (16.3 GiB held), so only models up to ~3.5 GiB could be loaded.
NOT run: inkling-2-mini, qwen-3.6-35b-a3b, nemotron-3.5-bolt-e4b-dflash, gemma-4-31b-it (VRAM held by production; the Inkling Q3_K_XL file was removed meanwhile and its Q4_K_XL replacement is 17.6 GB). A partial-offload run of an E4B model (CPU bound, noise 5-30%) is not usable.
Do not merge before the Inkling, Qwen3.6 MoE, Gemma 31B MTP and Nemotron DFlash presets are measured against dad3d43 with production stopped.
Assisted-by: Claude Sonnet 5.5