* 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
15 lines
689 B
Plaintext
15 lines
689 B
Plaintext
#include "common.cuh"
|
|
#include "ggml.h"
|
|
|
|
// fused-kernel recurrent-state output; strides in elements (per-seq stride is always D, set in-kernel)
|
|
struct ggml_cuda_gated_delta_net_fused_cache {
|
|
float * data; // rollback slot 0
|
|
int64_t slot_stride; // between rollback slots (0 when K==1)
|
|
};
|
|
|
|
void ggml_cuda_op_gated_delta_net(ggml_backend_cuda_context & ctx, ggml_tensor * dst);
|
|
|
|
// same op, but writes the snapshot(s) into the cache instead of dst (see ggml_cuda_try_gdn_cache_fusion)
|
|
void ggml_cuda_op_gated_delta_net_fused_cache(ggml_backend_cuda_context & ctx, ggml_tensor * dst,
|
|
ggml_cuda_gated_delta_net_fused_cache cache);
|