Commit Graph

4372 Commits

Author SHA1 Message Date
hksdpc255 46f9f0fb31
fix #1524 (#1543) 2026-03-29 18:50:09 +02:00
Kawrakow 3fa98d3213
Enable all CPU-backend FA supported quants by default (#1549) 2026-03-29 14:36:09 +02:00
Kawrakow bc2c74c9db
Add --fit to llama-bench (#1542) 2026-03-29 08:05:07 +02:00
Kawrakow 7831c69e27
Do not override mmap if GGML_CUDA_NO_PINNED is set (#1546) 2026-03-29 08:04:43 +02:00
Samuel Oliveira Alves c050bb9f3f
graph: Remove duplicate functions in MTP (#1530) 2026-03-28 15:43:24 +01:00
Kawrakow f83a29ff5a
Honor manual splits (#1540) 2026-03-28 13:03:43 +01:00
Kawrakow a95981013a
V-cache Hadamard transform (#1527) 2026-03-28 11:28:50 +01:00
Kawrakow 798af8676a
Correct available split modes in llama-bench (#1539) 2026-03-28 09:28:01 +01:00
Kawrakow 93ae47e167
Fix CUDA Hadamard transfrom bug (#1526) 2026-03-27 10:37:35 +01:00
Kawrakow 78977c0c0d
Fix jinja (#1518) 2026-03-26 17:24:11 +01:00
Kawrakow 8ab016e2d5
Fix bug in CPU floash attention for bf16 KV cache (#1521) 2026-03-26 17:22:27 +01:00
Kawrakow e46601cb19
Log probabilities on token sampling crash (#1519)
* Log probabilities on token sampling crash

* Typo
2026-03-26 14:34:41 +01:00
Kawrakow c06067fa14
Ignore MTP layer(s) when computing required memory (#1516) 2026-03-26 10:42:51 +01:00
Kawrakow 9eaf105ae8
Print info when allocating large amounts of pinned host memory (#1517) 2026-03-26 10:42:35 +01:00
Alec Koumjian aa7fdb3259
ggml-cuda: fix shared memory sizing in OpenAI argsort kernel (#1512) 2026-03-26 08:00:00 +01:00
Kawrakow 095bd3d3b2
Use pinned memory also with mmap when tensor overrides (#1510) 2026-03-26 06:15:54 +01:00
Kawrakow a84d90a4b8
Fix bug introduced in #1506 (#1515) 2026-03-26 06:04:51 +01:00
Kawrakow 4b1a6560a8
Update parameters documentation with new options (#1511)
Added descriptions for `--fit` and `--fit-margin`.
2026-03-25 18:23:44 +01:00
Kawrakow dd75fd054c
Fix KV cache for split mode graph with layers left on CPU (#1506) 2026-03-25 17:53:45 +01:00
Kawrakow d66dc7c0c4
CUDA: restore pinned memory usage for tensor overrides (#1508) 2026-03-25 17:18:32 +01:00
Samuel Oliveira Alves 1f3e832cb3
Improve mtp acceptance rate (#1499)
* wip: port MTP architecture

Ports the Multi-Token Prediction (MTP) architecture to the older `llama.cpp` codebase used by `ikllama`.

Changes include:
- Updating `llama_batch` to support `mtp_params`.
- Modifying `llama_decode_internal` (and `encode`) to handle MTP operations (Warmup, Update, Draft).
- Adding public APIs for MTP state management (`llama_set_draft_input_hidden_state`).
- Adapting the embedding extraction logic to skip MTP update passes.

* Refactors `server_slot` to support generic speculative decoding (MTP or Draft Model).

* core: enable hybrid outputs (logits + embeddings) for MTP support

* fix(mtp): correct KV-cache slot finding for updates

* fix(mtp): persist hidden states to prevent context corruption during drafting

* refactor(mtp): clean unused code

* fix(mtp): update server to new functions name

* fix(mtp): fix graph and save hidden state

* mtp: refactor integration, context params and kv cache search

* mtp: fix hidden state extraction and speculative acceptance flow

* server: fix MTP warmup for long prompts and reset token buffer

* llama: refactor MTP operation state to context parameters

* server: fix n_past calculation in MTP acceptance

* llama: fix mtp enable flags

* speculative: refactor MTP to use common_speculative interface

* context: remove unused signatures

* clip: fix deprecated enum-enum conversion warning

* common: fix format string crash in help message

* context: fix mtp activation logic

* llamat: always use the extracted embedding

* llama: get all embeddings to kv cache

* llama: revert logit to not run mtp for not supported arch

* llama: allocate all the n_outputs for MTP

* wip

* server-context: get only the last embedding for hidden state

* ggml-backend: fix array of bounds in debug build

* server-context: run mt kv update to each prompt batch

* revert segmentation fault fixes

* glm-mtp(feat): optimize graph embedding and recursive drafting
2026-03-25 10:20:22 +01:00
Adam Caldwell 3c4a7d18bd
mul_mat_q8_0_r8_q8_2: combine first/second half dot products before float conversion (#1505)
Co-authored-by: Adam Caldwell <accaldwell@users.noreply.github.com>
2026-03-25 09:47:10 +01:00
Kawrakow b6bac1aedb
Auto-fit for dense models (#1504)
* Auto-fit for dense models

* Minor
2026-03-25 08:28:15 +01:00
Kawrakow 86f4f516e5
Auto-fit offloaded tensors to available VRAM (MoE models) (#1501)
* WIP: automatically fit model in available VRAM

* WIP

* This seems pretty solid
2026-03-25 07:29:29 +01:00
Kawrakow 5451b149d4
Revert "Slightly better CPU performance for SWA models (#1496)" (#1503)
This reverts commit f4125e8b1f.
2026-03-25 07:20:34 +01:00
Kawrakow 233225db8f
Take into account layer sizes for setting GPU layers (count 2) (#1498)
* Also take into account KV cache

* Take into account attn_wkv_b and mla = 3 compute buffers

* WIP

* Minor
2026-03-24 08:18:28 +01:00
Aliez Ren f6c8b5f2cb
Update nix flake: sync with upstream, fix for newer nixpkgs (#1371)
* Update nix flake: sync with upstream, fix for newer nixpkgs

- Sync package.nix with upstream: add rocmGpuTargets/useRpc params,
  fix env optionals→optionalAttrs, remove unused inputs
- Rewrite devshells.nix to use mkShell directly instead of passthru
- Fix CUDA license check in nixpkgs-instances.nix for list-type licenses
- Update flake inputs (nixpkgs, flake-parts) to latest
- Update references from ggerganov/llama.cpp to ikawrakow/ik_llama.cpp

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Apply nix review suggestions from baileylu121 (#1371)

- Use legacyPackages instead of import to avoid extra nixpkgs instances
- Use inherit (pkgs) stdenv idiom
- Remove unnecessary lib.pipe wrapper in devshells.nix
- Simplify license normalization with lib.toList in nixpkgs-instances.nix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 08:17:52 +01:00
Kawrakow f4125e8b1f
Slightly better CPU performance for SWA models (#1496) 2026-03-24 07:53:16 +01:00
mcm007 bbc07002f7
Update docker and it's configs (#1497)
* Update ik_llama-cuda.Containerfile

- DGGML_NATIVE=ON, as most users are building images locally

- Latest llama-swap version

* Update ik_llama-cpu.Containerfile

- DGGML_NATIVE=ON, as most users are building images locally

- Latest llama-swap version

* Update README.md

- DGGML_NATIVE=ON is now default

* Update ik_llama-cuda-swap.config.yaml

- Adapt to the latest version

* Update ik_llama-cpu-swap.config.yaml

- Adapt to the latest version

* Update ik_llama-cuda-swap.config.yaml

- Add model with aliases

* Update ik_llama-cpu-swap.config.yaml

- Add model with aliases
2026-03-24 07:52:54 +01:00
Nexes the Elder 094f76ee86
Cleaner log for adjusted splits (#1494)
* sweep-bench: add more skipped patterns to --minilog

* cleaner log for adjusted splits

* Add totalization for adjusted splits

* Clean up semicolons

* Addition for totalizer ^^

* Change accordingly to review

* Forgotten leftover removed

* 'total' instead of 'totalized'
2026-03-24 07:49:40 +01:00
firecoperana cdf9142aa5
fix grammar stack empty error for qwen3.5 (#1490)
* fix grammar stack empty error for qwen3.5

* Add to --help

---------

Co-authored-by: firecoperana <firecoperana>
2026-03-24 07:48:20 +01:00
Kawrakow b7a2bde4cc
Take into account layer sizes for setting GPU layers (cont) (#1476)
* Also take into account KV cache

* Take into account attn_wkv_b and mla = 3 compute buffers
2026-03-23 17:46:53 +01:00
Kawrakow 4eb08208f2
Fix misleading quantize error message (#1493) 2026-03-23 13:55:18 +01:00
Adam Caldwell 47e4015337
Enable AVX-VNNI 256-bit path for Q3_K R4 matmul (#1472)
Add a separate HAVE_VNNI256 code path using _mm256_dpwssd_epi32 and
_mm256_dpbusd_epi32 for the Q3_K R4 kernel. The existing HAVE_FANCY_SIMD
(AVX-512 VNNI) path is preserved unchanged.

Co-authored-by: Adam Caldwell <accaldwell@users.noreply.github.com>
2026-03-23 09:47:29 +01:00
Kawrakow 3633a7cfca
Log HAVE_FANCY_SIMD via LLAMA_LOG_INFO (#1492) 2026-03-23 08:43:29 +01:00
gapeleon 716ecd6457
Added split mode graph for Command-R/R+ models. (#1491) 2026-03-23 08:10:41 +01:00
Adam Caldwell 87e4b9260b
Enable AVX-VNNI 256-bit path for Q6_K R4 matmul (#1482)
Add a separate HAVE_VNNI256 code path using _mm256_dpwssd_epi32 and
_mm256_dpbusd_epi32 for the Q6_K R4 kernel. The existing HAVE_FANCY_SIMD
(AVX-512 VNNI) path is preserved unchanged.

Co-authored-by: Adam Caldwell <accaldwell@users.noreply.github.com>
2026-03-23 08:10:13 +01:00
Kawrakow 56e026f6ba
Fix bug when splitting merged ffn_up/gate_exps tensors (#1479) 2026-03-20 18:54:45 +01:00
firecoperana 0c9bc3ed28
server: support --minilog to log request message for completions/response/anthropic and response (#1477)
Co-authored-by: firecoperana <firecoperana>
2026-03-20 16:13:43 +01:00
Adam Caldwell ac4d6b94fb
Enable AVX-VNNI 256-bit path for IQ3_XXS and IQ3_S R4 matmul (#1474)
Co-authored-by: Adam Caldwell <accaldwell@users.noreply.github.com>
2026-03-20 16:12:07 +01:00
firecoperana 10b44eca72
server: sync anthropic api code (#1469)
* server: sync anthropic api code

* fix cc header issue

---------

Co-authored-by: firecoperana <firecoperana>
2026-03-20 10:18:45 +01:00
Juk Armstrong 08f81b5afd
Fix batch calculation for image processing (#1475) 2026-03-20 10:16:05 +01:00
Nexes the Elder 6c665f38fd
sweep-bench: add -minilog argument to reduce verbose logging (#1468)
Purpose:
Add --minilog flag to llama-sweep-bench that filters log output to show only essential GPU/layer distribution information while suppressing verbose model metadata and per-layer device assignment messages.

Changes:
- Add llama_selective_log_callback with blacklist approach (sweep-bench.cpp)

Blacklisted patterns (hidden):
- Per-layer device assignments ('Setting default device in layer')
- KV metadata dump header and entries
- Tensor type counts
- Model validation messages
- EOG/special token cache info
- Metadata printout (llm_load_print_meta, print_info)
- Layer sizes table
- Tensor loading info (llm_load_tensors)
- Separator lines
- Most common cases of incomplete/continuation lines are also hidden

All other log output is shown, including:
- GPU VRAM info
- Split/buffer distribution per device
- Graph split estimates
- Final benchmark table and timings
2026-03-20 09:40:56 +01:00
Adam Caldwell a56a7863c7
Enable AVX-VNNI 256-bit path for IQ4_NL R4 matmul (#1467)
Co-authored-by: Adam Caldwell <accaldwell@users.noreply.github.com>
2026-03-20 09:40:39 +01:00
Max Homilius 77f8060ca6
fix: FA vec kernels for D=256 quantized KV cache (e.g., Qwen3-Coder-Next) (#1452)
* fix: FA vec kernels for D=256 quantized KV cache

Three bugs prevented Flash Attention from working with quantized
(q8_0) KV cache on models with head dimension 256, such as
Qwen3-Coder-Next:

1. need_f16_K/V used dimension-based logic (Dk != 128) that forced
   q8_0→f16 conversion at D=256. The kernel then read f16 data as
   q8_0 blocks. Changed to type-based logic (type_K == GGML_TYPE_F16)
   matching mainline.

2. quantize_q8_1_to_shared output pointers were not advanced between
   loop iterations, so the second iteration overwrote the first half
   of Q data in shared memory. Added i0 offset to output pointers.

3. Q_i32 register array in vec_f32 kernel was sized to 1 instead of 2
   for D=256 due to an errant comparison (Dk >= expr evaluates to
   boolean 1, not expr). Removed the comparison.

Also adds extern template declarations for (256, Q8_0, Q8_0) so the
kernel is compiled and linked.

Tested on Pascal (GTX 1080, CC 6.1) with Qwen3-Coder-Next (D=256,
n_head_kv=2) using --cache-type-k q8_0 --cache-type-v q8_0.

* fix: use dimension-based need_f16 for D=256 vec kernels
2026-03-20 09:39:39 +01:00
Kawrakow 0871ab2964
Take into account layer sizes for setting GPU layers (#1466)
* Take into account layer sizes for setting GPU layers

* Fix bug
2026-03-20 09:38:14 +01:00
Kawrakow b56a3c2dc9
Better barrier (#1456) 2026-03-19 07:33:00 +01:00
Kawrakow 9b7db9bc3f
Better --n-cpu-moe (#1464) 2026-03-19 06:57:01 +01:00
Adam Caldwell b8fa7936bf
Enable AVX-VNNI 256-bit path for Q8_K R8 matmul (#1460)
Use the sign trick with dpbusd instead of maddubs+madd+add,
replacing 3 AVX2 instructions with 1 fused VNNI instruction.
Removes dead HAVE_FANCY_SIMD code left over from the R16 split.

Co-authored-by: Adam Caldwell <accaldwell@users.noreply.github.com>
2026-03-19 06:56:11 +01:00
Kawrakow 1a7aa3e7fa
Fix potential integer overflow in the flash attention kernels (#1458) 2026-03-18 19:44:46 +01:00