koboldcpp/tools
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
..
batched-bench cmake : add install() for impl libraries + fix apple builds (#23511) 2026-05-22 11:46:26 +03:00
cli args: officially deprecate --mmap|mlock|dio (#28334) 2026-09-09 18:36:27 +08:00
completion args: officially deprecate --mmap|mlock|dio (#28334) 2026-09-09 18:36:27 +08:00
cvector-generator cmake : introduce semantic versioning (#26839) 2026-08-12 14:15:03 +02:00
export-lora docs: fix export-lora --lora-scaled syntax [no release] (#24703) 2026-06-18 16:46:17 +02:00
fit-params fit: also take into account n_streams (#27496) 2026-08-22 16:16:06 +02:00
gguf-split cmake : introduce semantic versioning (#26839) 2026-08-12 14:15:03 +02:00
imatrix imatrix.cpp: Move finite check and only check touched experts (#26861) 2026-08-11 11:18:19 -04:00
llama-bench args: officially deprecate --mmap|mlock|dio (#28334) 2026-09-09 18:36:27 +08:00
mtmd cmake : add PCH and unity build to improve build times (#28091) 2026-09-11 13:01:29 +02:00
perplexity quant : Optimise memory usage by evicting weights after processing each layer (#22877) 2026-08-18 16:22:32 +02:00
quantize quantize: cap working memory size to avoid loading big tensors onto RAM (#27795) 2026-08-27 18:31:13 +02:00
results libs : rename libcommon -> libllama-common (#21936) 2026-04-17 11:11:46 +03:00
rpc rpc: avoid serializing buffers from other servers (#26500) 2026-08-30 20:26:16 +03:00
server cmake : add PCH and unity build to improve build times (#28091) 2026-09-11 13:01:29 +02:00
tokenize tokenize : drop --stdin mutual-exclusion check (#25672) 2026-07-15 18:41:51 +02:00
tts args: add --video-* CLI arguments (#24318) 2026-08-27 12:11:12 +02:00
tuning ggml : update ggml_prec specification (#26675) 2026-09-08 09:06:24 +03:00
ui ui: Improve Chat Messages rendering performance (#28460) 2026-09-06 10:52:40 +02:00
CMakeLists.txt metal : per-device tuned (Q, NE) for flash-attn vec (#26570) 2026-08-24 19:22:27 +03:00