]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commit
Remove redundant CUDA copies after gated_delta_net. (#23940)
authorGaurav Garg <redacted>
Fri, 3 Jul 2026 09:06:29 +0000 (14:36 +0530)
committerGitHub <redacted>
Fri, 3 Jul 2026 09:06:29 +0000 (14:36 +0530)
commit5a460dea9f961cdb508d58a6e7b0f9e259b4c19f
treefcf2fae75d9af0512b7bb1d5c86f27ff2b612438
parentc8ae9a750c6c89dc928503a16175b7b3c2d224e4
Remove redundant CUDA copies after gated_delta_net. (#23940)

* Remove redundant CUDA copies after gated_delta_net.

Currently, GDN writes recurrent state snapshots into its output tail, then the graph immediately copies those snapshots into ssm_states_all. With MTP draft length 3, target decode uses K=4, so that becomes 4 extra ggml_cuda_cpy calls.

The change detects that gated_delta_net -> view -> cpy pattern and makes the CUDA GDN kernel write the state snapshot(s) directly into the recurrent cache, skipping the intermediate tail writes and copy kernels when safe.

* Address review comments
ggml/src/ggml-cuda/gated_delta_net.cu
ggml/src/ggml-cuda/gated_delta_net.cuh
ggml/src/ggml-cuda/ggml-cuda.cu