1#ifndef CKERNEL_RWKV7_DECODE_H
2#define CKERNEL_RWKV7_DECODE_H
54 const float *shift_in,
72 const float *shift_in,
137 const float *v_first,
156 const float *state_in,
181 const float *state_in,
210 const float *v_first_in,
232 const float *state_in,
244 size_t scratch_elems);
254 const float *shift_in,
263 size_t scratch_elems);
299 const float *att_shift_in,
300 const float *v_first_in,
301 const float *state_in,
343 float *att_shift_out,
347 size_t scratch_elems);
int ck_rwkv7_lora_gates(const float *xw, const float *xa, const float *xg, const float *w1, const float *w2, const float *w0, const float *a1, const float *a2, const float *a0, const float *g1, const float *g2, int dim, int rank_w, int rank_a, int rank_g, float *w_log, float *a_out, float *g_out)
int ck_rwkv7_apply_kk_factor(const float *k, const float *k_k, float *kk_raw, int dim)
int ck_rwkv7_vgate_vmix(const float *v_in, const float *v_first, const float *xv, const float *v1, const float *v2, const float *v0, int dim, int rank_v, float *v_out, float *v_first_out, float *v_gate)
int ck_rwkv7_channelmix_decode(const float *x, const float *shift_in, const float *mu, const float *Wk, const float *Wv, float *shift_out, float *out, int dim, int hidden_dim, float *scratch, size_t scratch_elems)
int(* ck_rwkv7_gemv_fn)(const float *W, const float *x, float *y, void *ctx)
size_t ck_rwkv7_time_mix_scratch_elems(int dim)
int(* ck_rwkv7_layer_norm_fn)(const float *x, const float *gamma, const float *beta, float *y, int dim, void *ctx)
size_t ck_rwkv7_time_mix_block_scratch_elems(int dim)
int ck_rwkv7_scale_k(const float *k_in, const float *a, const float *k_a, float *k_out, int dim)
int ck_rwkv7_state_readout(const float *state, const float *r, float *y, int head_dim)
int ck_rwkv7_token_shift_lerp(const float *x, const float *shift_in, const float *mu, float *xm, float *shift_out, int dim)
int ck_rwkv7_time_mix_shifts(const float *x, const float *shift_in, const float *mu_r, const float *mu_w, const float *mu_k, const float *mu_v, const float *mu_a, const float *mu_g, float *xr, float *xw, float *xk, float *xv, float *xa, float *xg, float *shift_out, int dim)
size_t ck_rwkv7_channelmix_scratch_elems(int dim, int hidden_dim)
int ck_rwkv7_state_step(const float *w_log, const float *k, const float *v, const float *kk, const float *a, const float *state_in, float *state_out, int head_dim)
int ck_rwkv7_time_mix_block(const float *h, const float *att_shift_in, const float *v_first_in, const float *state_in, const float *ln_g, const float *ln_b, const float *mu_r, const float *mu_w, const float *mu_k, const float *mu_v, const float *mu_a, const float *mu_g, const float *Wr, const float *Wk, const float *Wv, const float *Wo, const float *w1, const float *w2, const float *w0, const float *a1, const float *a2, const float *a0, const float *g1, const float *g2, const float *v1, const float *v2, const float *v0, const float *k_k, const float *k_a, const float *rk, const float *gn_w, const float *gn_b, float norm_eps, int dim, int num_heads, int head_dim, int rank_w, int rank_a, int rank_g, int rank_v, int is_layer_zero, ck_rwkv7_gemv_fn gemv, ck_rwkv7_layer_norm_fn layer_norm, void *ctx, float *h_out, float *att_shift_out, float *state_out, float *v_first_out, float *scratch, size_t scratch_elems)
int ck_rwkv7_wkv_decode(const float *r, const float *w_log, const float *k, const float *v, const float *kk, const float *a, const float *g, const float *rk, const float *ln_w, const float *ln_b, float norm_eps, const float *state_in, float *state_out, float *y_out, int num_heads, int head_dim)
int ck_rwkv7_norm_kk(const float *kk_in, float *kk_out, int num_heads, int head_dim)
int ck_rwkv7_time_mix_tail(const float *r, const float *k_raw, const float *v_in, const float *v_first_in, const float *xw, const float *xa, const float *xg, const float *xv, const float *w1, const float *w2, const float *w0, const float *a1, const float *a2, const float *a0, const float *g1, const float *g2, const float *v1, const float *v2, const float *v0, const float *k_k, const float *k_a, const float *rk, const float *ln_w, const float *ln_b, float norm_eps, const float *state_in, float *state_out, float *y_preproj, float *v_first_out, int dim, int num_heads, int head_dim, int rank_w, int rank_a, int rank_g, int rank_v, float *scratch, size_t scratch_elems)