Commit Graph

14 Commits

Author SHA1 Message Date
Samuel Oliveira Alves 7ebbb906d2
Initial implementation of DSpark (#2280)
* Implement initial arch for DSpark

* feat: Add Dspark architecture support

* avoid to many splits in graph and improve rope logic
2026-08-10 08:46:03 +02:00
Kawrakow daa54abd0b
DS4: do not cast caches to f32 (#2278)
* CUDA indexer topk: this is better for PP

* Don't overstep

* Cleanup

* Allow Q8_0 cache in the CUDA DSA implementation

* DS4: do not cast caches to f32
2026-08-08 17:19:23 +03:00
Joel Farthing e21eed5f58
deepseek4: compacted sliding-window KV cache (--swa-compress) (#2266)
Co-authored-by: Joel Farthing <262452229+joelfarthing@users.noreply.github.com>
2026-08-07 08:36:08 +03:00
Kawrakow 466d9bb15f
Merged up/gate for DS4 (#2257)
* Merged up/gate for DS4

* Just in case

* WIP

* Fix CUDA silu kernel for merged up/gate with limit
2026-08-07 07:51:58 +03:00
Forkoz 0a93e73a72
Make antirez GGUFs run at least (#2254) 2026-08-04 16:00:19 +03:00
Samuel Oliveira Alves 60389410a1
Apply helper functions to the MTP graph (#2238)
* refactor: streamline MTP state handling and input building functions

* move reshape logic outside mtp helper function
2026-08-03 19:27:19 +03:00
Samuel Oliveira Alves 0be97a7a5a
DeepSeek 4 MTP implementation (#2216)
* add standalone DeepSeek V4 MTP

* fix openPangu indexer tensor identities

* spec-bench: checkpoint DeepSeek V4 before draft

* minor changes in comments
2026-08-01 16:45:48 +03:00
Kawrakow 707374b3c3
DS4: faster long-context TG (#2201)
* DS4: faster long-context TG

* Also this
2026-07-30 13:13:42 +03:00
Kawrakow 6647db9c27
DS4: streamline RoPE (#2198)
* Use RoPE in-place to skip concatenating tensors

* Remove some code duplication

* Remove commented out code
2026-07-29 07:36:53 +03:00
Kawrakow 8a27bef8d4
DS4 refactoring (cont'd) (#2194) 2026-07-28 07:51:50 +03:00
Kawrakow 5f063b7bba
DS4 refactoring (#2190)
* DS4 refactoring

* Minor
2026-07-27 09:14:35 +03:00
Kawrakow e84c038310
DS4 optimizations (part 2) (#2179)
* DS4 optimizations (part 2)

* This is slightly better

* Another minor tweak

* Increase max. number of graph splitinputs to 64

Else with DS4 we can trun into an assert for specific offload
situations with more than one GPU.
2026-07-26 16:03:56 +03:00
Kawrakow bd342d624f
DS4 optimizations (#2169)
* Adding ds4_comp op with CPU implementation

* ds4_comp on CUDA

* ds4_comp: ratio = 4 specialization

Surprisingly small performance gain

* Also handle HCA via ds4_comp

But much smaller gain, if any.

* Delete commented out stuff

* Remove the [(size_t) il] noise

* Minor

* Fix quantized cache
2026-07-25 08:52:38 +03:00
Kawrakow 7945404458
DS4: slowly approaching a meaningful performance (#2165)
* initial map to load deepseek 4 arch

* wip

* wip: match graph build and attn logic for dpv4

* wip: Enhance DeepSeek-V4 architecture with new tensor types and sqrtsoftplus gating function

* Update DeepSeek-V4 to support raw key indexing with read/write indices

* fix mismatch in attn_raw

* Enable FA with CSA/HCA

* Fix logit mismatch with FA path

* Clean traces and logs for debug

* Refactor DSV4 tensor handling for MTP execution and improve raw context management

* Refactor DeepSeek4 tensor operations: replace manual weighted sum and post-processing with new helper functions

* Share mHC pre-projection and fix packed DSV4 writes

* DSV4: add shared top-k selection and improve mask handling

* Fix DSV4 c2048 view stride and duplicate loader instantiation

* Reuse shared RMS normalization in DSV4 graph

* Replace DSV4 indexer rotation with shared Hadamard

* Share CSA visibility mask with DSV4 LID

* dsv4: document dependency ordering and reset state

* Remove DSV4 zero-dependency graph shim

* Fix DSV4 packed stream execution

* Remove DSV4 l_out backend override

* Enable DSV4 quantized K-only cache

* Revert "Enable DSV4 quantized K-only cache"

This reverts commit 04f9b425321f62ba60e16d1bea2f8de714cfe855.

* Fix DSV4 quantized cache accounting

* Fail closed on unsupported DSV4 cache lifecycle operations

* Various optimizations

* llama: fix GGML_METAL=ON build - missing ggml-metal.h include in llama-dflash.cpp (#2134)

llama-dflash.cpp calls ggml_backend_is_metal() and
ggml_backend_metal_set_n_cb() inside an #ifdef GGML_USE_METAL block but
never includes ggml-metal.h, so any Metal-enabled build fails to
compile. Add the same guarded include llama.cpp already uses.

* New op: ggml_sum_rows_ext (#2132)

* Add ggml_sum_rows_ext

* openPangu: use ggml_sum_rows_ext also in mhc_post

* openPangu: use ggml_sum_rows_ext also in mhc_tail

* Minor

* Reuse shared inverse RoPE operation for DSV4

* Reuse maintainer CUDA concat implementation

* WIP

* hc_pre

* hc_post

* Remove unnecessary mask manipulations

* WIP

* Take into account swiglu limits

* Turn on fused indexer by default

* Give names to mat mul results

* More named ops

* dsv4: do not uselessly copy the KV cache

+20% TG at 32k tokens

* mask_to_index and make CPU FA work with that

* Much better CPU-only, CUDA still not functional

* Better CPU TG

I'm now at 9.7 t/s for zero context and 6.5 t/s for context of 32k.
PP is 120 t/s for short context and 101 t/s at 32k.

* Even better CPU TG

I'm now at 8.1 t/s for context of 32k tokens.

* Turn off DSA on CUDA for now

* Fix CUDA DSA

* Remove again the unnecessary softmax result buffer

* Experiments

* Various

* More named ops

* Forgot to uncomment

---------

Co-authored-by: samuel <samueloliveira32df@gmail.com>
Co-authored-by: hchengit <95317477+hchengit@users.noreply.github.com>
2026-07-22 17:18:57 +03:00