#include <limits.h>#include <math.h>#include <stddef.h>#include <stdint.h>#include <string.h>#include "bf16_utils.h"Go to the source code of this file.
Functions | |
| int | ck_full_softmax_topk_unrenormalized_f32_checked (const float *logits, int32_t *ids, float *scores, float *work, size_t rows, size_t experts, size_t top_k, size_t logits_elements, size_t route_elements) |
| int | ck_geglu_tanh_bf16_checked (const uint16_t *, const uint16_t *, uint16_t *, float *, size_t) |
| int | ck_linear_rows_bf16_blas_checked (const uint16_t *, size_t, const uint16_t *, size_t, uint16_t *, size_t, uint16_t *, size_t, double *, size_t, size_t, size_t, size_t) |
| int | ck_linear_rows_bf16_cblas_checked (const uint16_t *, size_t, const uint16_t *, size_t, uint16_t *, size_t, float *, size_t, size_t, size_t, size_t) |
| int | ck_linear_rows_bf16_checked (const uint16_t *, size_t, const uint16_t *, size_t, uint16_t *, size_t, uint16_t *, size_t, size_t, size_t, size_t) |
| int | ck_routed_geglu_bf16_cblas_checked (const uint16_t *input, const int32_t *ids, const float *scores, const uint16_t *gate_up, const uint16_t *down, uint16_t *out, uint16_t *routes, void *workspace, size_t workspace_bytes, size_t rows, size_t width, size_t inner, size_t experts, size_t top_k, size_t hidden_elements, size_t selected_elements, size_t route_elements, size_t gate_elements, size_t down_elements) |
| int | ck_routed_geglu_bf16_checked (const uint16_t *input, const int32_t *ids, const float *scores, const uint16_t *gate_up, const uint16_t *down, uint16_t *out, uint16_t *routes, void *workspace, size_t workspace_bytes, size_t rows, size_t width, size_t inner, size_t experts, size_t top_k, int use_blas, size_t hidden_elements, size_t selected_elements, size_t route_elements, size_t gate_elements, size_t down_elements) |
| int | ck_routed_softcapped_experts_checked_bf16 (const uint16_t *input, const int32_t *ids, const float *scores, const uint16_t *gate_up, const uint16_t *down, uint16_t *out, uint16_t *routes, void *workspace, size_t workspace_bytes, size_t rows, size_t width, size_t inner, size_t experts, size_t top_k, float gate_cap, float up_cap, size_t hidden_elements, size_t selected_elements, size_t route_elements, size_t gate_elements, size_t down_elements) |
| int | ck_routed_swiglu_fp32_route_sum_bf16_checked (const uint16_t *input, const int32_t *ids, const float *scores, const uint16_t *gate_up, const uint16_t *down, uint16_t *out, uint16_t *routes, void *workspace, size_t workspace_bytes, size_t rows, size_t width, size_t inner, size_t experts, size_t top_k, size_t hidden_elements, size_t selected_elements, size_t route_elements, size_t gate_elements, size_t down_elements) |
| int | ck_swiglu_bf16_checked (const uint16_t *, const uint16_t *, uint16_t *, float *, size_t) |
| static int | overlaps (const void *a, size_t a_bytes, const void *b, size_t b_bytes) |
| static int | project (const uint16_t *input, const uint16_t *weight, uint16_t *out, size_t rows, size_t in_width, size_t out_width, projection_workspace work) |
| static int | routed_experts_bf16_checked (const uint16_t *input, const int32_t *ids, const float *scores, const uint16_t *gate_up, const uint16_t *down, uint16_t *out, uint16_t *routes, void *workspace, size_t workspace_bytes, size_t rows, size_t width, size_t inner, size_t experts, size_t top_k, expert_arithmetic math, size_t hidden_elements, size_t selected_elements, size_t route_elements, size_t gate_elements, size_t down_elements) |
| static int | softcapped_swiglu (const uint16_t *gate, const uint16_t *up, uint16_t *output, size_t inner, expert_arithmetic math) |
| static int | span (const void *ptr, size_t bytes, size_t alignment) |
| int ck_full_softmax_topk_unrenormalized_f32_checked | ( | const float * | logits, |
| int32_t * | ids, | ||
| float * | scores, | ||
| float * | work, | ||
| size_t | rows, | ||
| size_t | experts, | ||
| size_t | top_k, | ||
| size_t | logits_elements, | ||
| size_t | route_elements ) |
Definition at line 284 of file routed_geglu_bf16_checked.c.
References ids, overlaps(), slot(), and span().
| int ck_geglu_tanh_bf16_checked | ( | const uint16_t * | gate, |
| const uint16_t * | up, | ||
| uint16_t * | out, | ||
| float * | stage, | ||
| size_t | elements ) |
Definition at line 161 of file bf16_checked_tensor_ops.c.
References gated_bf16(), and gelu_pytorch_tanh_bf16_storage().
Referenced by routed_experts_bf16_checked().
| int ck_linear_rows_bf16_blas_checked | ( | const uint16_t * | input, |
| size_t | input_elements, | ||
| const uint16_t * | weight, | ||
| size_t | weight_elements, | ||
| uint16_t * | output, | ||
| size_t | output_elements, | ||
| uint16_t * | staged, | ||
| size_t | staged_elements, | ||
| double * | work, | ||
| size_t | work_elements, | ||
| size_t | rows, | ||
| size_t | input_width, | ||
| size_t | output_width ) |
Definition at line 523 of file linear_rows_bf16_checked.c.
References bf16_to_float(), bind_dgemm(), dgemm, dgemm_once, float_to_bf16(), overlap(), and region_valid().
Referenced by project().
| int ck_linear_rows_bf16_cblas_checked | ( | const uint16_t * | input, |
| size_t | input_elements, | ||
| const uint16_t * | weight, | ||
| size_t | weight_elements, | ||
| uint16_t * | output, | ||
| size_t | output_elements, | ||
| float * | work, | ||
| size_t | work_elements, | ||
| size_t | rows, | ||
| size_t | input_width, | ||
| size_t | output_width ) |
Definition at line 596 of file linear_rows_bf16_checked.c.
References bf16_gemm, bf16_gemm_once, bf16_to_float(), bind_bf16_gemm(), float_to_bf16(), overlap(), and region_valid().
Referenced by project().
| int ck_linear_rows_bf16_checked | ( | const uint16_t * | input, |
| size_t | input_elements, | ||
| const uint16_t * | weight, | ||
| size_t | weight_elements, | ||
| uint16_t * | output, | ||
| size_t | output_elements, | ||
| uint16_t * | staged, | ||
| size_t | staged_elements, | ||
| size_t | rows, | ||
| size_t | input_width, | ||
| size_t | output_width ) |
Definition at line 479 of file linear_rows_bf16_checked.c.
References linear_rows_bf16_checked().
Referenced by project().
| int ck_routed_geglu_bf16_cblas_checked | ( | const uint16_t * | input, |
| const int32_t * | ids, | ||
| const float * | scores, | ||
| const uint16_t * | gate_up, | ||
| const uint16_t * | down, | ||
| uint16_t * | out, | ||
| uint16_t * | routes, | ||
| void * | workspace, | ||
| size_t | workspace_bytes, | ||
| size_t | rows, | ||
| size_t | width, | ||
| size_t | inner, | ||
| size_t | experts, | ||
| size_t | top_k, | ||
| size_t | hidden_elements, | ||
| size_t | selected_elements, | ||
| size_t | route_elements, | ||
| size_t | gate_elements, | ||
| size_t | down_elements ) |
Definition at line 243 of file routed_geglu_bf16_checked.c.
References ids, and routed_experts_bf16_checked().
| int ck_routed_geglu_bf16_checked | ( | const uint16_t * | input, |
| const int32_t * | ids, | ||
| const float * | scores, | ||
| const uint16_t * | gate_up, | ||
| const uint16_t * | down, | ||
| uint16_t * | out, | ||
| uint16_t * | routes, | ||
| void * | workspace, | ||
| size_t | workspace_bytes, | ||
| size_t | rows, | ||
| size_t | width, | ||
| size_t | inner, | ||
| size_t | experts, | ||
| size_t | top_k, | ||
| int | use_blas, | ||
| size_t | hidden_elements, | ||
| size_t | selected_elements, | ||
| size_t | route_elements, | ||
| size_t | gate_elements, | ||
| size_t | down_elements ) |
Definition at line 228 of file routed_geglu_bf16_checked.c.
References ids, and routed_experts_bf16_checked().
| int ck_routed_softcapped_experts_checked_bf16 | ( | const uint16_t * | input, |
| const int32_t * | ids, | ||
| const float * | scores, | ||
| const uint16_t * | gate_up, | ||
| const uint16_t * | down, | ||
| uint16_t * | out, | ||
| uint16_t * | routes, | ||
| void * | workspace, | ||
| size_t | workspace_bytes, | ||
| size_t | rows, | ||
| size_t | width, | ||
| size_t | inner, | ||
| size_t | experts, | ||
| size_t | top_k, | ||
| float | gate_cap, | ||
| float | up_cap, | ||
| size_t | hidden_elements, | ||
| size_t | selected_elements, | ||
| size_t | route_elements, | ||
| size_t | gate_elements, | ||
| size_t | down_elements ) |
Definition at line 256 of file routed_geglu_bf16_checked.c.
References ids, and routed_experts_bf16_checked().
| int ck_routed_swiglu_fp32_route_sum_bf16_checked | ( | const uint16_t * | input, |
| const int32_t * | ids, | ||
| const float * | scores, | ||
| const uint16_t * | gate_up, | ||
| const uint16_t * | down, | ||
| uint16_t * | out, | ||
| uint16_t * | routes, | ||
| void * | workspace, | ||
| size_t | workspace_bytes, | ||
| size_t | rows, | ||
| size_t | width, | ||
| size_t | inner, | ||
| size_t | experts, | ||
| size_t | top_k, | ||
| size_t | hidden_elements, | ||
| size_t | selected_elements, | ||
| size_t | route_elements, | ||
| size_t | gate_elements, | ||
| size_t | down_elements ) |
Definition at line 271 of file routed_geglu_bf16_checked.c.
References ids, and routed_experts_bf16_checked().
| int ck_swiglu_bf16_checked | ( | const uint16_t * | gate, |
| const uint16_t * | up, | ||
| uint16_t * | out, | ||
| float * | stage, | ||
| size_t | elements ) |
Definition at line 175 of file bf16_checked_tensor_ops.c.
References gated_bf16(), and silu_bf16_storage().
Referenced by routed_experts_bf16_checked().
|
static |
Definition at line 49 of file routed_geglu_bf16_checked.c.
Referenced by ck_full_softmax_topk_unrenormalized_f32_checked(), and routed_experts_bf16_checked().
|
static |
Definition at line 27 of file routed_geglu_bf16_checked.c.
References ck_linear_rows_bf16_blas_checked(), ck_linear_rows_bf16_cblas_checked(), and ck_linear_rows_bf16_checked().
Referenced by linear_rows_bf16_checked(), and routed_experts_bf16_checked().
|
static |
Definition at line 76 of file routed_geglu_bf16_checked.c.
References bf16_to_float(), ck_geglu_tanh_bf16_checked(), ck_swiglu_bf16_checked(), count, float_to_bf16(), ids, overlaps(), project(), slot(), softcapped_swiglu(), and span().
Referenced by ck_routed_geglu_bf16_cblas_checked(), ck_routed_geglu_bf16_checked(), ck_routed_softcapped_experts_checked_bf16(), and ck_routed_swiglu_fp32_route_sum_bf16_checked().
|
static |
Definition at line 60 of file routed_geglu_bf16_checked.c.
References bf16_to_float(), and float_to_bf16().
Referenced by routed_experts_bf16_checked().
|
static |
Definition at line 44 of file routed_geglu_bf16_checked.c.
Referenced by ck_full_softmax_topk_unrenormalized_f32_checked(), and routed_experts_bf16_checked().