Commit Graph

397 Commits

Author SHA1 Message Date
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
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 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
Kawrakow 56e026f6ba
Fix bug when splitting merged ffn_up/gate_exps tensors (#1479) 2026-03-20 18:54:45 +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
firecoperana f9b7fe9749
llama: add --dry-run option (#1462)
Co-authored-by: firecoperana <firecoperana>
2026-03-18 17:20:17 +01:00
Kawrakow 56477c7a9e
Mistral 4 support (#1450)
* WIP: mistral4

* CPU FA

* CUDA FA 320, 256
2026-03-18 07:32:39 +01:00
Kawrakow f6ca2fa8c0
Qwen-3.5/Next tweaks (#1447)
* Allow using -rtr and -muge together

* Various Qwen-3.5 tweaks

* No need to make v, g, beta contiguous

* Adjust NEON delta-net to non-contiguous v, g, b

* Cleanup

---------

Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
2026-03-18 07:32:17 +01:00
Kawrakow 54bcafee16
Allow using -rtr and -muge together (#1444) 2026-03-16 18:26:26 +01:00
Kawrakow e3f5f3d823
Minor delta-net tweaks (#1429) 2026-03-16 13:59:55 +01:00
Kawrakow d83b0172b1
Attempt to fix #1438 (#1439) 2026-03-16 08:34:17 +01:00
Kawrakow 56f4e9e673
Fix the fix (#1433) 2026-03-15 17:33:10 +01:00
Kawrakow edf54621d2
Fix long max. context bottleneck (#1430) 2026-03-15 17:18:27 +01:00
Kawrakow 10a8f5f8f1
Fix hybrid graph parallel + muge (#1426) 2026-03-14 18:15:09 +01:00
dungquixote42 be2940f57a
Adaptive P sampler: update review logic, delete old code comments, put prep stage after logit bias (#1386)
* simpler n_rewind logic, delete old comments

* use more consistent names, add updt_w_cur to json schema

* align comments

* refactor review logic, update struct/variable names

* revert cosmetic changes

* check enable/disable in llama_prep_adaptive_p_impl()

* delete extra whitespaces after statement

* show target in debug prints

* more concise debug print

* delete old comments

* update with loop instead of move()

* comment out all adaptive p debug prints

* more debug prints

* move review() variables: common_sampler struct -> common_sampler_review() args

* match n_unsent type

* fix merge bugs, delete adaptive p references in buffer_and_check_string_ban()

* restore accidental erasure

* Revert "adaptive p: collect probability before logit bias"

This reverts commit 1434878461c49d1a2a9047fc15d5e7b78421fd2a.
2026-03-14 12:34:12 +01:00
Kawrakow 46018f89ed
Fuse SILU and SSM_CONV (CPU) (#1421) 2026-03-14 08:27:32 +01:00
Kawrakow c2b8e95700
Be able to use imatrix computed with merged ffn_gate_up_exps (#1419)
* Be able to use imatrix computed with merged ffn_gate_up_exps

* Also the other way around
2026-03-13 17:57:56 +01:00
Kawrakow 9f4656fa7d
Faster top_n_sigma sampler (#1417)
* Faster top_n_sigma sampler

* This is better: 4000 t/s -> 8000 t/s
2026-03-13 10:53:45 +01:00
Kawrakow 7fab617684
Enable split mode graph for on-the-fly merged up/gate experts (#1413)
* Split mode graph for on-the-fly merged ffn_up/gate_exps

* Cleanup

* Also handle merged bias
2026-03-13 08:11:46 +01:00
firecoperana 433531ddae
server : support multi-modal context checkpoints and prompt caching (#1398)
* server : support multi-modal context checkpoints and prompt caching

do not create checkpoint right after image processing

improve mtmd check for slot ops

fix context shift

do not abort if template parse failed

* change to debug message when detecting ban token

---------

Co-authored-by: firecoperana <firecoperana>
2026-03-13 08:07:57 +01:00
Kawrakow c85361fe2f
Split mode graph for models with pre-merged ffn_up/ffn_gate experts (#1412)
* WIP: support pre-merged up/gate experts

Haha, mainline has elected to arrange the merged tensors
the other way around compared to what I had done in the on-the-fly merge.

* Change the order of on-the-fly packed up/gate

* OpenAI

* CUDA TG

* CPU

* Split mode graph for models with pre-merged ffn_up/ffn_gate experts
2026-03-12 17:26:48 +01:00
Kawrakow 5713d3b38b
Support models with merged up/gate experts (#1408)
* WIP: support pre-merged up/gate experts

Haha, mainline has elected to arrange the merged tensors
the other way around compared to what I had done in the on-the-fly merge.

* Change the order of on-the-fly packed up/gate

* OpenAI

* CUDA TG

* CPU
2026-03-12 09:25:57 +01:00
Kawrakow 1f4dcab5c6
Add abbility to merge up/gate expert tensors to Qwen3.5-MoE/Qwen3-Next (#1403) 2026-03-11 19:28:12 +01:00
Kawrakow cda15bf175
Discard very first compute graph for recurrent models (#1393) 2026-03-10 09:41:47 +01:00
Kawrakow f90b4c2f27
Full graph parallel for Qwen3.5 (dense and MoE) (#1388)
* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

* WIP

Loads and starts running, crashes with illegal memory access in
quantize_mmq_q8_1. This almost always indicates NaNs in the input
to the MoE FFN part.

* WIP

* WIP

Loads and runs, wrong results (very high PPL)
Performance looks promising, around 25% better than previous sm graph.
Needs f32 or bf16 graph reduce type.

* WIP - still wrong

* Fix after rebase

* WIP

* WIP

* This seems to be working for dense Qwen3.5!!!

* WIP: Qwen3-Next is not quite working

* Some cleanup

* Disable Qwen3-Next for now

* Disable graph parallel when mmproj was specified

* Read/write split recurrent state

* That should not crash

* Re-enable vision - it works now

* Recurrent layers should now be counted for split cache
2026-03-10 09:08:24 +01:00
firecoperana ab1d74074b
common : introduce composable PEG parser combinators for chat parsing and new jinja template engine (#1369)
---------

Co-authored-by: Piotr Wilkin <piotr.wilkin@syndatis.com>

common : add nemotron 3 parsing (#18077)

common : add parser for ministral/mistral large 3/devstral 2 (#17713)

common : default content to an empty string (#18485)

chat: make tool description and parameters optional per OpenAI spec (#18478)

Per the OpenAI API specification, both 'description' and 'parameters'
fields in tool function definitions are optional. Previously, the parser
would throw an exception if these fields were missing.

Attempts to fix #17667

common : implement new jinja template engine (#18462)
---------

Co-authored-by: Alde Rojas <hello@alde.dev>
Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>
Co-authored-by: Georgi Gerganov <ggerganov@gmail.com>

jinja: correct member access rule (#18905)

jinja : fix lexing of float literals with sign (#18901)

jinja : add missing tojson filter for bool (#18900)

jinja : attribute support for join, map and sort (#18883)

jinja : fix object item order (and properly implement dictsort) (#18904)

tests : add test-jinja -py option for cross-checking (#18906)

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

ci : run test-jinja -py on high perf [no ci] (#18916)

jinja : fix undefined keys and attributes and int/float as bool (#18924)

jinja: support none|string (#18995)

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

jinja : implement mixed type object keys (#18955)

---------

Co-authored-by: Xuan Son Nguyen <son@huggingface.co>

jinja : undefined should be treated as sequence/iterable (return string/array) by filters/tests (#19147)

`tojson` is not a supported `undefined` filter

keep it DRY and fix some types

jinja : do not pass empty tools and add some none filters (#19176)

jinja : add unordered_map include to value.h [no ci] (#19205)

jinja : add missing 'in' test to template engine (#19004) (#19239)

The jinja template parser was missing the 'in' test from
global_builtins(), causing templates using reject("in", ...),
select("in", ...), or 'x is in(y)' to fail with
"selectattr: unknown test 'in'".

This broke tool-calling for Qwen3-Coder and any other model
whose chat template uses the 'in' test.

Added test_is_in supporting array, string, and object containment
checks, mirroring the existing 'in' operator logic in runtime.cpp.

Includes test cases for all three containment types plus
reject/select filter usage.

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

---------

Co-authored-by: Sid Mohan <sidmohan0@users.noreply.github.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: Xuan Son Nguyen <son@huggingface.co>

Add Jinja support for "indent" string filter (#19529)

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

---------

Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com>

add vendor

refactor chat

server : support preserving reasoning_content in assistant message (#18994)

chat : fix translategemma crash on common_chat_format_example (#19019)

chat: fix language input for translategemma (#19052)

Co-authored-by: Aldehir Rojas <hello@alde.dev>

---------

Co-authored-by: Aldehir Rojas <hello@alde.dev>

chat: fix case where template accepts type content only (#19419)

mtmd : chat : Fix extra \n between text and media marker (#19595)

Thanks to @tugot17 for detecting and reporting the issue.

For vision models (e.g. LFM2.5-VL-1.6B and Qwen/Qwen3-VL-4B-Instruct) `llama-mtmd-cli` produces identical output to HF implementation.

However `llama-server` doesn't. I traced it down to extra newline
inserted after `<__media__>`.

This happens in `to_json_oaicompat`, that treats media markers as text
and joins all parts with `\n` separator.

PR introduces new type `media_marker` and uses it for media markers.
Extra logic is added to prevent insertion of newlines before and after
media markers.

With this change number of input tokens is identical to HF
implementation and as a result the output is also identical.

I explored other ways to address the issue
* remove completely `\n` between text parts in `to_json_oaicompat`
* merge text messages in server-common.cpp before sending them to `to_json_oaicompat`

Please propose alternative ways of fixing this issue.

Co-authored-by: Piotr Wilkin (ilintar) <piotr.wilkin@syndatis.com>

---------

Co-authored-by: Piotr Wilkin (ilintar) <piotr.wilkin@syndatis.com>

common : merge qwen3-coder and nemotron nano 3 parsers (#19765)

common : fix improper trimming in XML parser on complete message (#19805)

Co-authored-by: Jules LEIDELINGER <11395311+julio75012@users.noreply.github.com>

jinja: correct stats for tojson and string filters (#19785)

jinja : correct default size for string slices (#19913)

common : handle unicode during partial json parsing (#16526)

common : fix json schema with '\' in literals (#17307)

add back qwen_coder_xml and mirothinker

Co-authored-by: Aldehir Rojas <hello@alde.dev>
2026-03-09 11:03:33 +01:00
Kawrakow 344688ce50
Add all Qwen3.5 model types (#1378)
* Add all Qwen3.5 model types

* Need also this
2026-03-07 09:01:33 +01:00
usrlocalben c1c3421462
Fix incorrect --amb n_max_head fitting (#1375)
kv_f32_size should be fit to --amb by number of divisions, not heads per
division.

Regression in b85a2a5
2026-03-07 09:01:14 +01:00
Kawrakow 277fc1d26f
Do not repeat yourself (#1373)
* DRY - part 1

* DRY - part 2

* DRY - part 3

* Fix NEON

---------

Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
2026-03-06 16:06:51 +01:00
Kawrakow 082addead2
Minor: do not do SILU on the whole convolution output (#1374) 2026-03-06 16:06:34 +01:00
Kawrakow fa0c29843d
Fix split mode graph with Qwen3.5-MoE/Qwen3-Next hybryd inference (#1368) 2026-03-06 07:26:15 +01:00
Kawrakow 3208660d20
Be able to quantize mmproj files (#1367) 2026-03-06 07:25:40 +01:00
Kawrakow 1ef4b5eddc
Disable split mode graph for recurrent/hybrid models when tensor overrides (#1366) 2026-03-05 10:25:50 +01:00
Kawrakow 8fb002207a
Fused delta-net (AVX512) (#1362) 2026-03-05 07:55:05 +01:00
dungquixote42 a903409a5e
fix adaptive p sampler rewinding too far back (#1359)
* fix adaptive p sampler rewinding too far back

* update comments

* correct default value for total_weight, more comments

* new variables/names

* update comment for n_rewind

* move null pointer check back to common_sampler_review()

* refactor weighted_sum and total_weight to vector<pair>, better boundary check in llama_review_adaptive_p_impl()
2026-03-04 13:26:25 +01:00
Kawrakow fd16a418de
Fix clang warnings on macOS (#1354)
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
2026-03-03 16:27:16 +01:00
Kawrakow 3735e88925
Remove unused tensors from delta-net (#1350) 2026-03-02 16:02:40 +01:00
Kawrakow d239dabcc6
Graph parallel for Qwen-3.5-MoE (#1347)
* Graph parallel for Qwen3.5-MoE

* Add --max-gpu to llama-bench

* Fix graph reuse when not all GPUs participate in self-attention
2026-03-02 07:48:43 +01:00
Kawrakow a568e12c8f
Minor delta-net tweak (#1337) 2026-03-01 17:45:02 +01:00
Kawrakow 0ff3a43289
Bring back #1333 and #1335 (#1340)
* Bring back fused delta net 3

* Remove autoregressive and chunking
2026-02-28 14:31:42 +01:00
Kawrakow 1922449b2c
Revert delta net 3 (#1339)
* Revert "Simplify delta-net (#1335)"

This reverts commit e5fc30244c.

* Revert "Fused delta net 3 (#1333)"

This reverts commit 7b68353e09.
2026-02-28 13:12:08 +01:00
Kawrakow e5fc30244c
Simplify delta-net (#1335)
* Simplify delta-net

* Minor

* Minor
2026-02-28 11:12:19 +01:00
Kawrakow 7b68353e09
Fused delta net 3 (#1333)
* This is better than chunked

* Keep the state in registers

* Cleanup

* Remove unused stuff

* Minor

* Make fused delta-net the default

* Fix race
2026-02-27 15:02:56 +01:00
Kawrakow 1e6d36b1b4
Graph parallel for dense Qwen-3.5 models (#1331)
* Graph parallel for idense Qwen-3.5 models

* Cleanup
2026-02-27 07:03:25 +01:00
Kawrakow 62a7dcac5a
Move the Qwen-3.5 models to the standard attention mechanism (#1329) 2026-02-26 15:50:51 +01:00
Kawrakow 0aa6f7e7cd
iAdding support for dense Qwen-3.5 models (#1326) 2026-02-26 08:51:01 +01:00
Kawrakow 2616efa296
Fused delta net 2 (#1320)
* Revive fused delta-net

* Add command line argument for fused delta net

* Simplify/improve CUDA delta-net

* Add -fdn to llama-bench

* More CUDA fused delta net optimizations

* CPU optimizations

* Much faster fused delta-net on the CPU

It seems it is faster than the chunked implementation!

* Change meaning of fdn from bool flag to threshold value

* Use eps = 1e-6

* Give some nodes a name

* Don't re-apply L2 norm - it has already been done

* This seems quite a bit better

* More tweaks

* Restore per context buffer size log

Not everybody uses models split in 2000 parts, and those who do,
actually want to see the biffer sizes.
2026-02-26 06:53:43 +01:00