koboldcpp/src
Daniel Bevenius 3bcfeb700f
cmake : add PCH and unity build to improve build times (#28091)
* scripts : add initial profiling script (wip)

* src : add precompile headers (PCH) for models.h

* common : add common.h as PCH

* ggml : add PCH for ggml-impl.h

* mtmd : use PCH for models.h

* scripts : add script to build with Server/Tools/Tests

* server : add PCH for common.h

* docs: add profiling progress notes (wip)

* ggml : add exclude for GCC + SVE on ARM

Refs: https://github.com/ggml-org/llama.cpp/actions/runs/33393906061/job/99493756214?pr=28091

* ggml : attempt to fix use of std::hardware_destructive_inference_size

Refs: https://github.com/ggml-org/llama.cpp/actions/runs/33396221677/job/99501265689?pr=28091

* squash! ggml : attempt to fix use of std::hardware_destructive_inference_size

Add a version check for GCC 12 to conditionally apply the `-Winterference-size`
pragma.

* editorconfig : exclude profiling reports dir

This directory will not be included in the merge later and this commit
can be ignore at that point. Just fixing to keep CI happy.

* ggml : skip PCH for gcc on non-x86 architectures

* tests : add PCH for peg-parser/tests.h

There are 7 peg-parser tests that can share one PCH instead of then each
parsing the full tests.h.

* common : add PCH for chat.h

* docs : update linux build profiling full results

Just updating after a number of PCH additions. These are not exact
figures and will vary a bit from run to run, but they give a general idea
of the performance impact of PCH.

* cmake : introduce unity build for models

This commit introduces a unity build for the models to improve
compilation time.

The improvements were roughly the following:
```console
+------------------------+-----+------------+------------+------------+
| Build                  | TUs | Frontend   | Backend    | Total      |
+------------------------+-----+------------+------------+------------+
| Full,    master        | 396 |   811.0 s  |   692.2 s  | 1,503.2 s  |
| Full,    with PCH      | 405 |   380.0 s  |   664.7 s  | 1,044.7 s  |
| Full,    with PCH + UB | 264 |   357.7 s  |   635.7 s  |   993.4 s  |
+------------------------+-----+------------+------------+------------+

TU   = Translation Unit.
Full = includes Server, Tools, and Tests.
PCH  = precompiled headers.
UB   = unity build for models.
```

* docs : update linux profiling table with unitiy build results

* docs : update mac profiling results to include unity build [no ci]

* docs: remove profiling reports

* scripts : merge build profile scripts into one script

I was lazy before and just copied the first script to enable Tests,
Server, and Tools. This now merges them into a single script.

* Revert "editorconfig : exclude profiling reports dir" [no ci]

This reverts commit 2922a12118a0730d2f7632bcba265b44a0856c59.

* src : rename ggml_view_2d_slice to gemma3n_view_2d_slice

This is to be consistent with the rename in gemma4.cpp which was
required to avoid a name clash.

* cmake : add build profile script for windows [no ci]

This commit adds a port of the scripts/build-profile.sh script to
windows powershell.

This was developed on Windows on ARM but should work on X64 as well but
needs to be tested there as well.
2026-09-11 13:01:29 +02:00
..
models cmake : add PCH and unity build to improve build times (#28091) 2026-09-11 13:01:29 +02:00
CMakeLists.txt cmake : add PCH and unity build to improve build times (#28091) 2026-09-11 13:01:29 +02:00
llama-adapter.cpp llama : check LoRA tensor data is within file bounds (#27056) 2026-08-16 09:38:01 +03:00
llama-adapter.h llama : re-enable manual LoRA adapter free (#19983) 2026-03-18 12:03:26 +02:00
llama-arch.cpp model : support Kimi-K3 recurrent-state rollback (#28466) 2026-09-08 11:31:48 +08:00
llama-arch.h [Model] Support for Spark2_5ForCausalLM implementation (#27868) 2026-09-06 17:43:58 +02:00
llama-batch.cpp llama-batch: fix allowed decreasing pos in a seq (#25449) 2026-07-08 19:24:34 +03:00
llama-batch.h llama-batch: add n_keep_tail in split_equal for recurrent models (#25278) 2026-07-08 15:55:19 +08:00
llama-chat.cpp chat : add Granite 4.1 chat template (#23518) 2026-05-28 13:13:33 +02:00
llama-chat.h chat : add Granite 4.1 chat template (#23518) 2026-05-28 13:13:33 +02:00
llama-context.cpp metal : single-source fusion table + fusion debug rework (#28164) 2026-09-11 12:41:54 +03:00
llama-context.h llama: refactor fused ops (#24646) 2026-07-08 18:18:09 +08:00
llama-cparams.cpp cparams : rename LLAMA_MAX_PARALLEL_SEQUENCES to LLAMA_MAX_SEQ (#14188) 2025-06-15 10:08:58 +03:00
llama-cparams.h context : autoscale n_ctx_train when yarn scaling specified (#28030) 2026-09-01 19:59:54 +03:00
llama-ext.h spec : add DFlash2 support (local convolution + candidate selector) (#27342) (#27816) 2026-08-27 19:17:07 +02:00
llama-grammar.cpp grammar : fix max repetition threshold (#28469) 2026-09-06 11:59:10 +03:00
llama-grammar.h common/grammar : replace problematic backtracking regex [\s\S]* (#18342) 2026-01-03 16:02:43 -06:00
llama-graph.cpp ggml : update ggml_prec specification (#26675) 2026-09-08 09:06:24 +03:00
llama-graph.h llama : add missing headers (#28566) 2026-09-08 12:59:53 +02:00
llama-hparams.cpp src : add n_expert_used_max function (#28323) 2026-09-04 06:36:51 +02:00
llama-hparams.h model : add Tencent Hy 4 (hy_v4) preview architecture support (#28127) 2026-09-04 14:31:36 +02:00
llama-impl.cpp llama : correct platform-independent loading of BOOL metadata (#21428) 2026-04-06 01:40:38 +02:00
llama-impl.h llama: refactor fused ops (#24646) 2026-07-08 18:18:09 +08:00
llama-io.cpp server : avoid checkpoint data host copies (#22558) 2026-05-02 18:03:25 +03:00
llama-io.h llama : add option to save memory in device buffers (#22679) 2026-05-05 06:35:07 +03:00
llama-kv-cache-dsa-iswa.cpp model: add dots3-note (#27060) 2026-08-21 19:52:34 +02:00
llama-kv-cache-dsa-iswa.h model: add dots3-note (#27060) 2026-08-21 19:52:34 +02:00
llama-kv-cache-dsa.cpp llama : allocate indexer cache only in "full" indexer layers (#26474) 2026-08-03 14:56:30 +02:00
llama-kv-cache-dsa.h llama : allocate indexer cache only in "full" indexer layers (#26474) 2026-08-03 14:56:30 +02:00
llama-kv-cache-dsv4.cpp Deepseek 4: -sm tensor (#26490) 2026-08-24 09:20:25 +03:00
llama-kv-cache-dsv4.h DeepseekV4 MTP + DSpark (#25784) 2026-08-02 20:55:34 +08:00
llama-kv-cache-iswa.cpp llama-batch: add n_keep_tail in split_equal for recurrent models (#25278) 2026-07-08 15:55:19 +08:00
llama-kv-cache-iswa.h DeepSeek V4 (#24162) 2026-06-29 16:58:51 +08:00
llama-kv-cache-msa.cpp model: M3: Move MSA into a new memory implementation (#26338) 2026-08-03 16:30:08 +03:00
llama-kv-cache-msa.h model: M3: Move MSA into a new memory implementation (#26338) 2026-08-03 16:30:08 +03:00
llama-kv-cache.cpp model, mtmd: fix gemma4 vision handling (#28335) 2026-09-04 12:23:27 +02:00
llama-kv-cache.h model: add Qwen3.8-Flash-Next (qwen4exp) (#27742) 2026-08-27 21:32:31 +02:00
llama-kv-cells.h kv-cells: look up the n-gram history in the sequence position index (#28040) 2026-09-01 20:16:07 +02:00
llama-memory-hybrid-idx.cpp memory : avoid allocating V cache for indexer (it's not used) (#28330) 2026-09-10 10:55:46 +02:00
llama-memory-hybrid-idx.h qwen4exp: fix seq_cp, block position keying, mtmd input, cuda abort, add tests (#27941) 2026-09-01 13:22:04 +03:00
llama-memory-hybrid-iswa.cpp llama-batch: add n_keep_tail in split_equal for recurrent models (#25278) 2026-07-08 15:55:19 +08:00
llama-memory-hybrid-iswa.h llama + spec: MTP Support (#22673) 2026-05-16 20:06:23 +08:00
llama-memory-hybrid.cpp llama-batch: add n_keep_tail in split_equal for recurrent models (#25278) 2026-07-08 15:55:19 +08:00
llama-memory-hybrid.h llama + spec: MTP Support (#22673) 2026-05-16 20:06:23 +08:00
llama-memory-recurrent.cpp model: add Qwen3.8-Flash-Next (qwen4exp) (#27742) 2026-08-27 21:32:31 +02:00
llama-memory-recurrent.h model: add Qwen3.8-Flash-Next (qwen4exp) (#27742) 2026-08-27 21:32:31 +02:00
llama-memory.cpp memory : correctly handle failure in apply() (#14438) 2025-06-30 18:03:03 +03:00
llama-memory.h llama : add Gemma4 MTP (#23398) 2026-06-07 20:50:54 +08:00
llama-mmap.cpp llama : add missing headers (#28566) 2026-09-08 12:59:53 +02:00
llama-mmap.h llama: model_loader: add TENSOR_READ_LAZY (#27794) 2026-08-27 15:14:34 +02:00
llama-model-loader.cpp src : add n_expert_used_max function (#28323) 2026-09-04 06:36:51 +02:00
llama-model-loader.h llama: improve TENSOR_READ_LAZY handling (#27837) 2026-08-30 16:59:48 +02:00
llama-model-saver.cpp [Model] Support for Spark2_5ForCausalLM implementation (#27868) 2026-09-06 17:43:58 +02:00
llama-model-saver.h model: add Qwen3.8-Flash-Next (qwen4exp) (#27742) 2026-08-27 21:32:31 +02:00
llama-model.cpp model : fix MTP context kv cache allocation for deepseek2, glm4moe, … (#28630) 2026-09-11 12:02:31 +03:00
llama-model.h model: fix all granite family parameter counts (#28643) 2026-09-10 09:49:56 +03:00
llama-quant.cpp quantize: row-slab stream to avoid thread starvation (#27830) 2026-09-01 11:18:54 +02:00
llama-quant.h llama : refactor src/llama.cpp (#10902) 2025-01-03 10:18:53 +02:00
llama-sampler.cpp llama : use int32_t for llama_sampler_chain_n return type (#28631) 2026-09-09 15:27:25 +03:00
llama-sampler.h llama : support multi-output backend sampling (#25532) 2026-08-10 16:58:56 +03:00
llama-version.h.in llama: fix whole source code rebuilt on each new commit (#28278) 2026-09-03 23:53:04 +02:00
llama-vocab.cpp llama : add missing headers (#28566) 2026-09-08 12:59:53 +02:00
llama-vocab.h [Model] Support for Spark2_5ForCausalLM implementation (#27868) 2026-09-06 17:43:58 +02:00
llama.cpp llama: fix whole source code rebuilt on each new commit (#28278) 2026-09-03 23:53:04 +02:00
unicode-data.cpp server : better security control for public deployments (#9776) 2024-10-08 13:27:04 +02:00
unicode-data.h llama : reduce compile time and binary size (#9712) 2024-10-02 15:49:55 +02:00
unicode.cpp unicode : include '~' in collapsed symbol class (#26972) 2026-08-18 15:15:22 +02:00
unicode.h vocab: fix Gemma4 tokenizer (#21343) 2026-04-03 10:33:03 +02:00