FP32 SSM causal depthwise convolution kernels for qwen3next/Qwen3.5. More...
#include "bf16_utils.h"#include "ckernel_engine.h"#include "ck_threadpool.h"#include <math.h>#include <stddef.h>#include <string.h>Go to the source code of this file.
Functions | |
| static void | ck_ssm_conv1d_llama_channel_range (int begin, int end, void *opaque) |
| static void | ck_ssm_conv1d_llama_fma_channel_range (int begin, int end, void *opaque) |
| void | ssm_conv1d_backward (const float *d_out, const float *conv_x, const float *kernel, float *d_conv_x, float *d_kernel, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
| void | ssm_conv1d_backward_ref (const float *d_out, const float *conv_x, const float *kernel, float *d_conv_x, float *d_kernel, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
| void | ssm_conv1d_forward (const float *conv_x, const float *kernel, float *out, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
| void | ssm_conv1d_forward_llama_fma (const float *conv_x, const float *kernel, float *out, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
| void | ssm_conv1d_forward_llama_production (const float *conv_x, const float *kernel, float *out, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
| void | ssm_conv1d_forward_llama_production_serial (const float *conv_x, const float *kernel, float *out, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
| void | ssm_conv1d_forward_pytorch_bf16_storage (const float *conv_x, const float *kernel, float *out, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
| void | ssm_conv1d_forward_ref (const float *conv_x, const float *kernel, float *out, int kernel_size, int num_channels, int num_tokens, int num_seqs) |
FP32 SSM causal depthwise convolution kernels for qwen3next/Qwen3.5.
After changes: make test-ssm-conv && make test-kernels
This file implements the GGML_OP_SSM_CONV semantics used by qwen3next before the recurrent DeltaNet update: out[seq, token, ch] = dot(conv_x[seq, ch, token:token+kernel], kernel[ch, :])
Memory layouts: conv_x : [num_seqs, num_channels, kernel_size - 1 + num_tokens] kernel : [num_channels, kernel_size] out : [num_seqs, num_tokens, num_channels] d_out : same as out d_conv_x : same as conv_x d_kernel : same as kernel
Definition in file ssm_kernels.c.
|
static |
Definition at line 155 of file ssm_kernels.c.
References end.
Referenced by ssm_conv1d_forward_llama_production(), and ssm_conv1d_forward_llama_production_serial().
|
static |
Definition at line 240 of file ssm_kernels.c.
References end.
Referenced by ssm_conv1d_forward_llama_fma().
| void ssm_conv1d_backward | ( | const float * | d_out, |
| const float * | conv_x, | ||
| const float * | kernel, | ||
| float * | d_conv_x, | ||
| float * | d_kernel, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 316 of file ssm_kernels.c.
References ssm_conv1d_backward_ref().
| void ssm_conv1d_backward_ref | ( | const float * | d_out, |
| const float * | conv_x, | ||
| const float * | kernel, | ||
| float * | d_conv_x, | ||
| float * | d_kernel, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 78 of file ssm_kernels.c.
Referenced by ssm_conv1d_backward().
| void ssm_conv1d_forward | ( | const float * | conv_x, |
| const float * | kernel, | ||
| float * | out, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 128 of file ssm_kernels.c.
References ssm_conv1d_forward_ref().
Referenced by ck_test_ssm_conv1d().
| void ssm_conv1d_forward_llama_fma | ( | const float * | conv_x, |
| const float * | kernel, | ||
| float * | out, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 272 of file ssm_kernels.c.
References ck_ssm_conv1d_llama_fma_channel_range(), ck_threadpool_global(), ck_threadpool_n_threads(), and ck_threadpool_parallel_for_n().
| void ssm_conv1d_forward_llama_production | ( | const float * | conv_x, |
| const float * | kernel, | ||
| float * | out, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 207 of file ssm_kernels.c.
References ck_ssm_conv1d_llama_channel_range(), ck_threadpool_global(), ck_threadpool_n_threads(), and ck_threadpool_parallel_for_n().
| void ssm_conv1d_forward_llama_production_serial | ( | const float * | conv_x, |
| const float * | kernel, | ||
| float * | out, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 189 of file ssm_kernels.c.
References ck_ssm_conv1d_llama_channel_range().
| void ssm_conv1d_forward_pytorch_bf16_storage | ( | const float * | conv_x, |
| const float * | kernel, | ||
| float * | out, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 299 of file ssm_kernels.c.
References bf16_to_float(), float_to_bf16(), and ssm_conv1d_forward_ref().
| void ssm_conv1d_forward_ref | ( | const float * | conv_x, |
| const float * | kernel, | ||
| float * | out, | ||
| int | kernel_size, | ||
| int | num_channels, | ||
| int | num_tokens, | ||
| int | num_seqs | ||
| ) |
Definition at line 39 of file ssm_kernels.c.
Referenced by ssm_conv1d_forward(), and ssm_conv1d_forward_pytorch_bf16_storage().