#include "ckernel_engine.h"#include <math.h>#include <string.h>#include <stdio.h>#include <stdlib.h>Go to the source code of this file.
Functions | |
| static int | ck_mamba_debug_enabled (void) |
| static void | ck_mamba_debug_finite (const char *name, const float *x, size_t n) |
| void | mamba2_conv1d_decode_f32 (const float *state_in, const float *x, const float *weight, const float *bias, float *conv_out, float *state_out, int rows, int conv_dim, int kernel_size) |
| void | mamba2_conv1d_f32_channel_range (const float *state_in, const float *x, const float *weight, const float *bias, float *conv_out, float *state_out, int rows, int conv_dim, int kernel_size, int channel_begin, int channel_end) |
| void | mamba2_dt_softplus_f32 (const float *dt, const float *dt_bias, float *dt_out, int rows, int num_heads, float dt_min, float dt_max) |
| void | mamba2_in_proj_split_f32 (const float *projected, float *gate, float *hidden_bc, float *dt, int rows, int d_mlp, int intermediate_dim, int conv_dim, int num_heads) |
| void | mamba2_rmsnorm_gate_f32 (const float *x, const float *gate, const float *weight, float *out, int rows, int inner_dim, int group_size, float eps) |
| void | mamba2_selective_scan_f32 (const float *state_init, const float *x, const float *dt, const float *a, const float *b, const float *c, const float *d, float *state_out, float *y, int batch, int seq_len, int num_heads, int head_dim, int state_dim, int num_groups) |
| void | mamba2_selective_scan_f32_head_range (const float *state_init, const float *x, const float *dt, const float *a, const float *b, const float *c, const float *d, float *state_out, float *y, int batch, int seq_len, int num_heads, int head_dim, int state_dim, int num_groups, int head_begin, int head_end) |
| void | mamba2_selective_state_update_decode_f32 (const float *state_in, const float *x, const float *dt, const float *a, const float *b, const float *c, const float *d, float *state_out, float *y, int rows, int num_heads, int head_dim, int state_dim, int num_groups) |
| static float | mamba2_sigmoid_f32 (float x) |
| static float | mamba2_silu_f32 (float x) |
| static float | mamba2_softplus_f32 (float x) |
|
static |
Definition at line 9 of file mamba2_kernels.c.
Referenced by ck_mamba_debug_finite().
|
static |
Definition at line 18 of file mamba2_kernels.c.
References ck_mamba_debug_enabled().
Referenced by mamba2_conv1d_decode_f32(), mamba2_dt_softplus_f32(), mamba2_in_proj_split_f32(), mamba2_rmsnorm_gate_f32(), and mamba2_selective_scan_f32().
| void mamba2_conv1d_decode_f32 | ( | const float * | state_in, |
| const float * | x, | ||
| const float * | weight, | ||
| const float * | bias, | ||
| float * | conv_out, | ||
| float * | state_out, | ||
| int | rows, | ||
| int | conv_dim, | ||
| int | kernel_size | ||
| ) |
Definition at line 148 of file mamba2_kernels.c.
References ck_mamba_debug_finite(), and mamba2_conv1d_f32_channel_range().
| void mamba2_conv1d_f32_channel_range | ( | const float * | state_in, |
| const float * | x, | ||
| const float * | weight, | ||
| const float * | bias, | ||
| float * | conv_out, | ||
| float * | state_out, | ||
| int | rows, | ||
| int | conv_dim, | ||
| int | kernel_size, | ||
| int | channel_begin, | ||
| int | channel_end | ||
| ) |
Definition at line 102 of file mamba2_kernels.c.
References mamba2_silu_f32().
Referenced by mamba2_conv1d_decode_f32().
| void mamba2_dt_softplus_f32 | ( | const float * | dt, |
| const float * | dt_bias, | ||
| float * | dt_out, | ||
| int | rows, | ||
| int | num_heads, | ||
| float | dt_min, | ||
| float | dt_max | ||
| ) |
Definition at line 171 of file mamba2_kernels.c.
References ck_mamba_debug_finite(), and mamba2_softplus_f32().
| void mamba2_in_proj_split_f32 | ( | const float * | projected, |
| float * | gate, | ||
| float * | hidden_bc, | ||
| float * | dt, | ||
| int | rows, | ||
| int | d_mlp, | ||
| int | intermediate_dim, | ||
| int | conv_dim, | ||
| int | num_heads | ||
| ) |
Definition at line 65 of file mamba2_kernels.c.
References ck_mamba_debug_finite().
| void mamba2_rmsnorm_gate_f32 | ( | const float * | x, |
| const float * | gate, | ||
| const float * | weight, | ||
| float * | out, | ||
| int | rows, | ||
| int | inner_dim, | ||
| int | group_size, | ||
| float | eps | ||
| ) |
Definition at line 373 of file mamba2_kernels.c.
References ck_mamba_debug_finite(), end, mamba2_silu_f32(), and start.
| void mamba2_selective_scan_f32 | ( | const float * | state_init, |
| const float * | x, | ||
| const float * | dt, | ||
| const float * | a, | ||
| const float * | b, | ||
| const float * | c, | ||
| const float * | d, | ||
| float * | state_out, | ||
| float * | y, | ||
| int | batch, | ||
| int | seq_len, | ||
| int | num_heads, | ||
| int | head_dim, | ||
| int | state_dim, | ||
| int | num_groups | ||
| ) |
Definition at line 339 of file mamba2_kernels.c.
References ck_mamba_debug_finite(), and mamba2_selective_scan_f32_head_range().
| void mamba2_selective_scan_f32_head_range | ( | const float * | state_init, |
| const float * | x, | ||
| const float * | dt, | ||
| const float * | a, | ||
| const float * | b, | ||
| const float * | c, | ||
| const float * | d, | ||
| float * | state_out, | ||
| float * | y, | ||
| int | batch, | ||
| int | seq_len, | ||
| int | num_heads, | ||
| int | head_dim, | ||
| int | state_dim, | ||
| int | num_groups, | ||
| int | head_begin, | ||
| int | head_end | ||
| ) |
Definition at line 264 of file mamba2_kernels.c.
Referenced by mamba2_selective_scan_f32().
| void mamba2_selective_state_update_decode_f32 | ( | const float * | state_in, |
| const float * | x, | ||
| const float * | dt, | ||
| const float * | a, | ||
| const float * | b, | ||
| const float * | c, | ||
| const float * | d, | ||
| float * | state_out, | ||
| float * | y, | ||
| int | rows, | ||
| int | num_heads, | ||
| int | head_dim, | ||
| int | state_dim, | ||
| int | num_groups | ||
| ) |
Definition at line 204 of file mamba2_kernels.c.
|
inlinestatic |
Definition at line 40 of file mamba2_kernels.c.
Referenced by mamba2_silu_f32().
|
inlinestatic |
Definition at line 51 of file mamba2_kernels.c.
References mamba2_sigmoid_f32().
Referenced by mamba2_conv1d_f32_channel_range(), and mamba2_rmsnorm_gate_f32().
|
inlinestatic |
Definition at line 55 of file mamba2_kernels.c.
Referenced by mamba2_dt_softplus_f32().