ik_llama_opt/gguf-py/gguf
Kawrakow 3e536b95b0 Add optional MLA (#188)
* Deepseek MLA Optimizations

Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>

* Make MLA optional

* Remove some unnecessary copies in the MLA attention

* Deepseek MLA Optimizations V2 (#195)

* Avoid allocating MHA KV cache when MLA is turned on

* Added missing gguf-py file

* Added final optimizations

Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>

* Make sure we do have wk_b and wv_b before enabling MLA

---------

Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>

* Use type_k and type_v to set the types of the MLA caches

They were hard-coded at f16.
On my Ryzen-7950X with native bf16 support I get a fairly
significant PP performance boost with bf16 KV-cache:
PP-4096 = 320 t/s up from 292 t/s with fp16 KV-cache.

* Better gemm strategy when nth > nhead

It gives a ~10% PP performance boost for DeepSeek-Lite with 32 threads
(with or without MLA).
Before this commit, when nth > nhead heads were processed
sequentially with all nth threads participating in each
matrix multiplication. Now we ind the gcd of nhead and
nth and split threads into nth/gcd groups, each group
processing nhead/gcd heads.

---------

Co-authored-by: Saood Karim <saood05@gmail.com>
Co-authored-by: Stanisław Szymczyk <sszymczy@gmail.com>
Co-authored-by: Iwan Kawrakow <iwan.kawrakow@gmail.com>
2025-02-09 19:48:44 +02:00
..
__init__.py Merge mainline llama.cpp (#3) 2024-07-27 07:55:01 +02:00
constants.py Add optional MLA (#188) 2025-02-09 19:48:44 +02:00
gguf.py gguf-py: Refactor and allow reading/modifying existing GGUF files (#3981) 2023-11-11 08:04:50 +03:00
gguf_reader.py Merge mainline llama.cpp (#3) 2024-07-27 07:55:01 +02:00
gguf_writer.py Deepseek V3 support added (#176) 2025-01-23 18:24:10 +02:00
lazy.py Merge mainline - Aug 12 2024 (#17) 2024-08-12 15:14:32 +02:00
metadata.py Merge mainline - Aug 12 2024 (#17) 2024-08-12 15:14:32 +02:00
py.typed convert : various script cleanups/fixes + merges and special token handling (#2842) 2023-08-30 11:25:50 +03:00
quants.py Merge mainline - Aug 12 2024 (#17) 2024-08-12 15:14:32 +02:00
tensor_mapping.py Add optional MLA (#188) 2025-02-09 19:48:44 +02:00
utility.py Merge mainline llama.cpp (#3) 2024-07-27 07:55:01 +02:00
vocab.py Move convert.py to examples/convert-legacy-llama.py (#7430) 2024-05-30 21:40:00 +10:00