Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 0 additions & 104 deletions cuda/include/kernels.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ int fastnn_cuda_clamp(const float* a, float min_val, float max_val, float* out,
int fastnn_cuda_relu(const float* input, float* output, size_t n);
int fastnn_cuda_relu_backward(const float* grad_output, const float* input, float* grad_input, size_t n);
int fastnn_cuda_leaky_relu(const float* input, float negative_slope, float* output, size_t n);
int fastnn_cuda_leaky_relu_backward(const float* grad_output, const float* input, float negative_slope, float* grad_input, size_t n);
int fastnn_cuda_sigmoid(const float* input, float* output, size_t n);
int fastnn_cuda_sigmoid_backward(const float* grad_output, const float* output, float* grad_input, size_t n);
int fastnn_cuda_tanh_forward(const float* input, float* output, size_t n);
Expand Down Expand Up @@ -70,73 +69,6 @@ int fastnn_cuda_sum_axis(const float* input, float* output, int* shape, int ndim
int fastnn_cuda_mean(const float* input, float* output, size_t n);
int fastnn_cuda_max(const float* input, float* output, size_t n);
int fastnn_cuda_min(const float* input, float* output, size_t n);
int fastnn_cuda_argmax(const float* input, int* output, size_t n);
int fastnn_cuda_argmax_axis(const float* input, int* output, int outer, int axis_size, int inner);

int fastnn_cuda_conv2d_forward(
const float* input, const float* weight, const float* bias, float* output,
int batch_size, int in_channels, int out_channels,
int input_h, int input_w,
int kernel_h, int kernel_w,
int stride_h, int stride_w,
int pad_h, int pad_w);

int fastnn_cuda_conv2d_backward_data(
const float* grad_output, const float* weight, float* grad_input,
int batch_size, int in_channels, int out_channels,
int input_h, int input_w, int output_h, int output_w,
int kernel_h, int kernel_w,
int stride_h, int stride_w,
int pad_h, int pad_w);

int fastnn_cuda_conv2d_backward_weight(
const float* input, const float* grad_output, float* grad_weight,
int batch_size, int in_channels, int out_channels,
int input_h, int input_w, int output_h, int output_w,
int kernel_h, int kernel_w,
int stride_h, int stride_w,
int pad_h, int pad_w);

int fastnn_cuda_max_pool2d(
const float* input, float* output, int* indices,
int batch_size, int channels,
int input_h, int input_w,
int kernel_h, int kernel_w,
int stride_h, int stride_w,
int pad_h, int pad_w);

int fastnn_cuda_max_pool2d_backward(
const float* grad_output, const int* indices, float* grad_input,
int batch_size, int channels,
int input_h, int input_w,
int output_h, int output_w);

int fastnn_cuda_avg_pool2d(
const float* input, float* output,
int batch_size, int channels,
int input_h, int input_w,
int kernel_h, int kernel_w,
int stride_h, int stride_w,
int pad_h, int pad_w);

int fastnn_cuda_adaptive_avg_pool2d(
const float* input, float* output,
int batch_size, int channels,
int input_h, int input_w,
int output_h, int output_w);

int fastnn_cuda_batch_norm_forward(
const float* input, const float* gamma, const float* beta,
float* running_mean, float* running_var,
float* output, float* save_mean, float* save_inv_var,
int batch_size, int channels, int spatial_size,
float momentum, float epsilon, int training);

int fastnn_cuda_batch_norm_backward(
const float* grad_output, const float* input,
const float* gamma, const float* save_mean, const float* save_inv_var,
float* grad_input, float* grad_gamma, float* grad_beta,
int batch_size, int channels, int spatial_size);

int fastnn_cuda_layer_norm_forward(
const float* input, const float* gamma, const float* beta,
Expand All @@ -149,45 +81,9 @@ int fastnn_cuda_layer_norm_backward(
float* grad_input, float* grad_gamma, float* grad_beta,
int batch_size, int normalized_size);

int fastnn_cuda_rms_norm_forward(
const float* input, const float* gamma,
float* output, float* rms,
int batch_size, int normalized_size, float epsilon);

int fastnn_cuda_dropout_forward(const float* input, float* output, float* mask, float p, size_t n, unsigned long long seed);
int fastnn_cuda_dropout_backward(const float* grad_output, const float* mask, float* grad_input, float p, size_t n);

int fastnn_cuda_embedding_forward(const int* indices, const float* weight, float* output, int num_indices, int embedding_dim);
int fastnn_cuda_embedding_backward(const int* indices, const float* grad_output, float* grad_weight, int num_indices, int embedding_dim, int num_embeddings);

int fastnn_cuda_cross_entropy_loss(const float* log_probs, const int* targets, float* loss, float* grad, int batch_size, int num_classes);
int fastnn_cuda_mse_loss(const float* predictions, const float* targets, float* loss, float* grad, size_t n);
int fastnn_cuda_binary_cross_entropy(const float* predictions, const float* targets, float* loss, float* grad, size_t n);

int fastnn_cuda_scaled_dot_product_attention(
const float* query, const float* key, const float* value,
float* output, float* attn_weights,
const float* mask,
int batch_size, int num_heads, int seq_len_q, int seq_len_k, int head_dim,
float scale, int causal);

int fastnn_cuda_sgd_step(float* params, const float* grads, float* velocity,
float lr, float momentum, float weight_decay, float dampening,
int nesterov, size_t n);

int fastnn_cuda_adam_step(float* params, const float* grads,
float* m, float* v,
float lr, float beta1, float beta2, float epsilon,
float weight_decay, int step, int amsgrad, float* v_max,
size_t n);

int fastnn_cuda_fill(float* data, float value, size_t n);
int fastnn_cuda_copy(const float* src, float* dst, size_t n);
int fastnn_cuda_arange(float* output, float start, float step, size_t n);
int fastnn_cuda_where(const float* condition, const float* x, const float* y, float* output, size_t n);
int fastnn_cuda_gather(const float* input, const int* indices, float* output,
int outer_size, int gather_dim_size, int inner_size, int num_indices);

#ifdef __cplusplus
}
#endif
Expand Down
Loading
Loading