Skip to content

Merge tag 'b9888' of https://github.com/ggml-org/llama.cpp into feature/turboquant-kv-cache#208

Open
sxlmnwb wants to merge 258 commits into
TheTom:feature/turboquant-kv-cachefrom
sxlmnwb:feature/turboquant-kv-cache
Open

Merge tag 'b9888' of https://github.com/ggml-org/llama.cpp into feature/turboquant-kv-cache#208
sxlmnwb wants to merge 258 commits into
TheTom:feature/turboquant-kv-cachefrom
sxlmnwb:feature/turboquant-kv-cache

Conversation

@sxlmnwb

@sxlmnwb sxlmnwb commented Jul 6, 2026

Copy link
Copy Markdown

Summary Merge 'b9888' of https://github.com/ggml-org/llama.cpp

Resolved files conflicts:

1. ggml/src/ggml-cuda/fattn.cu

  • Added TurboQuant types (turbo2, turbo3, turbo4) to the ggml_cuda_fattn_kv_type_supported function
  • Used the upstream helper function for KV type validation with an additional 64-byte alignment check for turbo types

2. ggml/src/ggml-metal/ggml-metal.metal

  • Combined template instantiation for kernel_cpy_tq3_1s and kernel_cpy_tq4_1s (TurboQuant copy kernels)

3. src/llama-kv-cache.cpp

  • Incorporate Hadamard rotation logic for DeepSeek architectures (DEEPSEEK32 and DEEPSEEK4)
  • Use more comprehensive upstream conditions

4. src/llama-model-loader.cpp

  • Adopts the llama_ftype_name structure from upstream with guessed_prefix_len
  • Adds the TQ3_1S and TQ4_1S types to the switch case

5. tests/test-backend-ops.cpp

  • Incorporates test cases from upstream (Q4_0, Q8_0, MXFP4)
  • Retained the TurboQuant TQ4_1S test cases for kernel validation

6. tests/test-quantize-fns.cpp

  • Added TQ3_1S to the list of types that use MAX_DOT_PRODUCT_ERROR_LOWBIT

7. tools/server/server-context.cpp (5 conflicts)

  • Fixed slot selection logic by using task.id_slot instead of id_slot
  • Merged the cache_key slot selection from the fork
  • Used batch.size() instead of batch.n_tokens for consistency with upstream
  • Fixed the prompt_checkpoint_restored flag
  • Merged checkpoint logic with is_last_user_message
  • Replaced continue/break with return in the iterate lambda
  • Removed references to nonexistent functions (llama_get_ctx_other, process_chunk)

8. tools/server/server-models.cpp (6 conflicts)

  • Use the upstream state-based protocol structure (CMD_CHILD_TO_ROUTER_STATE)
  • Retain the CMD_CHILD_TO_ROUTER_ERROR handler for the abort callback
  • Use the update_status_args struct for the update_status signature
  • Fix the should_wake lambda with an inline lambda
  • Use the child_proc->is_alive() and child_proc->terminate() methods instead of direct C functions
  • Merged update_last_error and update_download_progress

9. tools/server/server-models.h

  • Added the CMD_CHILD_TO_ROUTER_STATE define
  • Merged method declarations from upstream and fork

10. tools/server/server.cpp

  • Merged the common_models_handler initialization from upstream
  • Retained the abort callback for error reporting from child processes
  • Used a more comprehensive router condition (path.empty() && hf_repo.empty())

Additional information

Build environment:

export MY_FLAGS_NVIDIA="-march=znver5 -mtune=znver5 -O3 -pipe -flto=thin -fno-fat-lto-objects -fno-strict-aliasing -Wno-unused-command-line-argument -Wno-missing-noreturn -Wno-unreachable-code-break -mllvm -polly -mllvm -polly-tiling=1 -mllvm -polly-run-inliner -mllvm -polly-dependences-computeout=0 -mllvm -polly-ast-use-context"
export MY_LINKER_FLAGS="-fuse-ld=mold -Wl,--thinlto-jobs=$(nproc) -Wl,-rpath,/home/sxlmnwb/kernel-build/xBoreUp_Clang/lib/x86_64-unknown-linux-gnu"

cmake -B build-nvidia \
    -DGGML_CUDA=ON \
    -DGGML_CUDA_CUDNN=ON \
    -DGGML_RPC=ON \
    -DCUDAToolkit_ROOT=/opt/cuda \
    -DCMAKE_CUDA_COMPILER=/opt/cuda/bin/nvcc \
    -DCMAKE_CUDA_ARCHITECTURES=89 \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_C_COMPILER=/home/sxlmnwb/kernel-build/xBoreUp_Clang/bin/clang \
    -DCMAKE_CXX_COMPILER=/home/sxlmnwb/kernel-build/xBoreUp_Clang/bin/clang++ \
    -DCMAKE_CUDA_HOST_COMPILER=clang++ \
    -DCMAKE_C_FLAGS="$MY_FLAGS_NVIDIA" \
    -DCMAKE_CXX_FLAGS="$MY_FLAGS_NVIDIA -stdlib=libc++" \
    -DCMAKE_EXE_LINKER_FLAGS="$MY_LINKER_FLAGS -lc++ -lc++abi" \
    -DCMAKE_SHARED_LINKER_FLAGS="$MY_LINKER_FLAGS -lc++ -lc++abi"

Build log:
PANd6hWU

Tested on:
CPU: AMD Ryzen AI 9 HX 370 (8+16) @ 5.16 GHz
GPU 2: NVIDIA GeForce RTX 4060 Max-Q / Mobile [Discrete]

MoE model:
Qwen3.6-35B-A3B-Uncensored-HauhauCS-Aggressive - Q4_K_P

Screenshot From 2026-07-07 02-39-29

Requirements

leonardHONG and others added 30 commits June 15, 2026 09:11
* ui: add svg block visualizer based on allozaur's mermaid PR

* ui: rationalise diagram block styling and pre transforms shared by mermaid and svg

* ui: live render streaming svg blocks

* ui: also render svg authored in xml code fences

* ui: refactor svg block rendering, address review from allozaur

- Move the svg size ceiling and DOMPurify config out of sanitize-svg.ts into /constants.
- Rename the svg-diagram class to svg-block so the name no longer implies diagrams only.
- Replace the svg, xml and svg tag magic strings in the markdown pipeline with shared constants.
- Promote the data-svg-rendered marker and its sibling data attributes to constants.

* ui: render svg blocks in a shadow root for animation and live zoom

Mount each sanitized svg inside an open shadow root so author <style> and
keyframe or smil animations run while staying scoped to the host element.
Relax the sanitizer to forbid only foreignObject and script, which lets
animation, href and external resource refs through for wider compatibility.
Render the inline block and the zoom dialog from the same reactive source,
so a streaming svg keeps drawing live inside the open zoom popup.
* chat: fix whitespace problems once and for all

* Purge trailing spaces from grammar generation

* Revert "Purge trailing spaces from grammar generation"

This reverts commit b0827ec.
* [SYCL] Centralize Level Zero detection in ggml_sycl_init

* use the same wording

* get back the warning

* [SYCL] Remove per-allocation getenv() for GGML_SYCL_ENABLE_LEVEL_ZERO

* bring back the comment

* move it up to make sure devices call the shots

* move the env detection early

* replace g_ggml_sycl_enable_level_zero with a direct call to .ext_oneapi_level_zero

* update the comment

* switch back to g_ggml_sycl_enable_level_zero with a sentinel

* remove the check

* Reduce the diff

* reword, move lower

* move things aroudn

* remove forward declaration if favor of a full replace

* pre-cache results of zeDeviceGetProperties

* put ggml_sycl_get_env back

* replace get_sycl_env with ggml_sycl_get_env

* add whitespace back

* Apply suggestion from @sanmai
…gml-org#24584)

* add to support pool_1d, move pool_1d/2d code to pool.cpp/hpp

* update ops.md
Assisted-by: pi:llama.cpp/Qwen3.6-27B
…uring last changes (ggml-org#24653)

* chat: fix an "oldie but goodie" grammar generator bug that surfaced during last changes

* update erroneous case in PEG parser test
* chat: harden peg-native tool call parsing

accept an optional leading type: function field in
build_json_tools_flat_keys so openai style tool calls parse on
templates whose serialization opens on the name field.

return a clean error and log the unparsed fragment on a final peg
parse failure instead of throwing the raw parser position and input.

keep the raw arguments string in func_args_not_string when it is not
valid json instead of aborting the prompt render.

* chat: surface peg-native parse failures

a final peg parse failure threw the raw parser position and input. log
the unparsed fragment and raise a clearer error instead, so a model
output that does not match the expected format no longer fails silently
with an empty assistant turn.

minimal change, no behavior change on successful parses.

* chat: handle openai style tool calls in peg-native

* nits

* common: scope OpenAI wrapper grammar trigger via autoparser flag

* chat: gate type:function parsing leniency on the analysis flag

Thread accept_openai_wrapper from the generator to build_json_tools_flat_keys
so the leading "type": "function" field is accepted only when openai_wrapper_trigger is set.
…org#22219)

* docs: Add instructions to install `llama.cpp` from conda-forge

Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>

* Rewording of instructions

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

---------

Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
* Add escape test cases

* chat : fix LFM2 tool-call parsing double-escaping
* vulkan: add GGML_OP_COL2IM_1D, follow-up to the CPU op

* vulkan: col2im_1d bounded gather loop instead of full-K scan with modulo

* vulkan: col2im_1d address review from @jeffbolznv

* vulkan: col2im_1d return nullptr for unsupported types, address review from @0cc4m
* Add -cl-fp32-correctly-rounded-divide-sqrt to F16=ON builds

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

* Make GGML_SYCL_F16=ON the default

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

* Leave F32 the default

F16 remains explictly set for example and Dockerfile builds.

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

* Revert changes to examples/sycl/build scripts

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>

---------

Signed-off-by: Todd Malsbary <todd.malsbary@intel.com>
…gml-org#24363)

* support OP EXPM1, support all UT cases of FLOOR, TRUNC, ROUND

* fix conflict

* rebase, support new UT case of repeat, concat
* sycl: support reordered Q4_K and Q5_K MoE MUL_MAT_ID

Extend reordered-weight handling to fused MoE MUL_MAT_ID for Q4_K and Q5_K expert tensors and add Q5_K reordered DMMV coverage. Unsupported 3D reorder cases now fall back instead of aborting.

* sycl: extend MoE reorder to Q6_K mul_mat_id
* bench : add --offline

Signed-off-by: Adrien Gallouët <angt@huggingface.co>

* Add default

Signed-off-by: Adrien Gallouët <angt@huggingface.co>

---------

Signed-off-by: Adrien Gallouët <angt@huggingface.co>
… position (ggml-org#24536)

* spec: add spec metrics mean acceptance length and acceptance per pos

* fix as suggestion

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* fix as suggestion

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* fix as suggestion

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

* fix as suggestions

---------

Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>
…2930)

* implement UMA host-visible memory

* update based on 0cc4m's suggestion
* Move post-GEMM MUL required for dequant b4 lora and bias add

see ggml-org#23484 :
1. For lora, I would presume we want fully dequantized values before
   doing the residuals, but this depends on how the LORAs were
generated. Literature tells me LORA happens post-mul but pre-bias add ggml-org#8332
2. For ModelOPT, bias-add should happen on [fully-dequantized
   values](https://github.com/NVIDIA/Model-Optimizer/blob/b49f9b9e2d747af992d78a3aa7f10efe5a8847e1/modelopt/torch/quantization/backends/nvfp4_gemm.py#L59-L64)

* Restrict build_ffn for NVFP4 to supported combinations
* ui: add source toggle to mermaid and svg blocks

Add a toggle button next to copy and preview that switches a rendered
mermaid or svg block to its source code and back. The button is shared by
both block types and the rendered view stays the default.

The source view reuses the code block scroll container and the highlighted
code element captured at transform time, so it matches the app code blocks
without highlighting again.

Make tall diagrams scroll like text code blocks: safe centering keeps the
diagram centered when it fits and falls back to start alignment when it
overflows, so the top stays reachable instead of clipping above.

Keep the block header opaque and layered above the scrolled diagram, and
ignore header clicks in the zoom handler, so a button click never falls
through to the zoom dialog.

* ui: transparent diagram block header, address review from @allozaur
angt and others added 10 commits July 6, 2026 09:53
Signed-off-by: Adrien Gallouët <angt@huggingface.co>
The matmul_tiled path uses large local stack buffers for A_pack and B_pack. On AIX this can trigger a segmentation fault, so reduce the buffer footprint there to keep the tiled path usable.

 Performance Impact:
    ~ 2x gains in PP_Speed for FP32, Q4_0 and Q8_0 models tested with llama-bench, llama-batched-bench and llama-cli.
    Models used: Llama3.2 3b Instruct F32, qwen 2.5 3b Q4_0 and Q8_0
…rg#24403)

* CUDA: extend K-type validation to V-types for flash attention

* reorder
…re/turboquant-kv-cache

Fix Conflicts:
    ggml/src/ggml-cuda/fattn.cu
    ggml/src/ggml-metal/ggml-metal.metal
    src/llama-kv-cache.cpp
    src/llama-model-loader.cpp
    tests/test-backend-ops.cpp
    tests/test-quantize-fns.cpp
    tools/server/server-context.cpp
    tools/server/server-models.cpp
    tools/server/server-models.h
    tools/server/server.cpp

Signed-off-by: Salman Wahib <sxlmnwb.dev@gmail.com>
Adds target_compile_options for ggml-cuda to suppress verbose warnings
from GGML_ABORT macros and template expansions when using Clang as the
CUDA host compiler.

- -Wno-missing-noreturn (GGML_ABORT does not return)
- -Wno-unreachable-code-break (break after GGML_ABORT)
- -Wno-tautological-compare (template type comparisons)
- -diag-suppress=177 (NVCC unused variable in templates)

Signed-off-by: Salman Wahib <sxlmnwb.dev@gmail.com>
- add banner

Signed-off-by: Salman Wahib <sxlmnwb.dev@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.