#include "checked_float_buffer.h"#include "checked_parallel.h"#include <dlfcn.h>#include <limits.h>#include <math.h>#include <pthread.h>#include <stdint.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Typedefs | |
| typedef void(* | sgemm_fn) (int, int, int, int, int, int, float, const float *, int, const float *, int, float, float *, int) |
| typedef void(* | vector_erf_fn) (int, const float *, float *) |
Functions | |
| static void | attend_rows (size_t begin, size_t end, void *opaque) |
| static int | attention_impl (const float *query, size_t qn, const float *key, size_t kn, const float *value, size_t vn, float *out, size_t on, float *scratch, size_t sn, size_t queries, size_t memory, size_t heads, size_t dim, int pool) |
| static void | bind_sgemm (void) |
| int | ck_attention_cross_sgemm_f32 (const float *query, size_t qn, const float *key, size_t kn, const float *value, size_t vn, float *out, size_t on, float *scratch, size_t sn, size_t queries, size_t memory, size_t heads, size_t dim) |
| int | ck_attention_cross_sgemm_pool_f32 (const float *query, size_t qn, const float *key, size_t kn, const float *value, size_t vn, float *out, size_t on, float *scratch, size_t sn, size_t queries, size_t memory, size_t heads, size_t dim) |
| int | ck_gelu_rows_vector_erf_f32 (const float *x, size_t xn, size_t xs, float *out, size_t on, size_t os, float *stage, size_t sn, size_t rows, size_t channels) |
| int | ck_gelu_rows_vector_erf_pool_f32 (const float *x, size_t xn, size_t xs, float *out, size_t on, size_t os, float *stage, size_t sn, size_t rows, size_t channels) |
| int | ck_linear_rows_sgemm_checked (const float *x, size_t xn, const float *w, size_t wn, const float *bias, size_t bn, float *out, size_t on, float *stage, size_t sn, size_t m, size_t k, size_t n) |
| static int | gelu_impl (const float *x, size_t xn, size_t xs, float *out, size_t on, size_t os, float *stage, size_t sn, size_t rows, size_t channels, int pool) |
| static void | gelu_range (size_t begin, size_t end, void *opaque) |
| static int | intersects (const float *a, size_t an, const float *b, size_t bn) |
| static int | valid_region (const float *p, size_t count) |
Variables | |
| static pthread_once_t | once = PTHREAD_ONCE_INIT |
| static sgemm_fn | sgemm |
| static vector_erf_fn | vector_erf |
| typedef void(* sgemm_fn) (int, int, int, int, int, int, float, const float *, int, const float *, int, float, float *, int) |
Definition at line 12 of file linear_rows_sgemm_checked.c.
| typedef void(* vector_erf_fn) (int, const float *, float *) |
Definition at line 15 of file linear_rows_sgemm_checked.c.
|
static |
Definition at line 76 of file linear_rows_sgemm_checked.c.
Referenced by attention_impl().
|
static |
Definition at line 106 of file linear_rows_sgemm_checked.c.
References attend_rows(), attend_rows(), bind_sgemm(), ck_checked_finite_bulk(), ck_checked_parallel_for(), intersects(), once, sgemm, and valid_region().
Referenced by ck_attention_cross_sgemm_f32(), and ck_attention_cross_sgemm_pool_f32().
|
static |
Definition at line 19 of file linear_rows_sgemm_checked.c.
References sgemm, and vector_erf.
Referenced by attention_impl(), ck_linear_rows_sgemm_checked(), and gelu_impl().
| int ck_attention_cross_sgemm_f32 | ( | const float * | query, |
| size_t | qn, | ||
| const float * | key, | ||
| size_t | kn, | ||
| const float * | value, | ||
| size_t | vn, | ||
| float * | out, | ||
| size_t | on, | ||
| float * | scratch, | ||
| size_t | sn, | ||
| size_t | queries, | ||
| size_t | memory, | ||
| size_t | heads, | ||
| size_t | dim ) |
Definition at line 172 of file linear_rows_sgemm_checked.c.
References attention_impl().
| int ck_attention_cross_sgemm_pool_f32 | ( | const float * | query, |
| size_t | qn, | ||
| const float * | key, | ||
| size_t | kn, | ||
| const float * | value, | ||
| size_t | vn, | ||
| float * | out, | ||
| size_t | on, | ||
| float * | scratch, | ||
| size_t | sn, | ||
| size_t | queries, | ||
| size_t | memory, | ||
| size_t | heads, | ||
| size_t | dim ) |
Definition at line 177 of file linear_rows_sgemm_checked.c.
References attention_impl().
| int ck_gelu_rows_vector_erf_f32 | ( | const float * | x, |
| size_t | xn, | ||
| size_t | xs, | ||
| float * | out, | ||
| size_t | on, | ||
| size_t | os, | ||
| float * | stage, | ||
| size_t | sn, | ||
| size_t | rows, | ||
| size_t | channels ) |
Definition at line 182 of file linear_rows_sgemm_checked.c.
References gelu_impl().
| int ck_gelu_rows_vector_erf_pool_f32 | ( | const float * | x, |
| size_t | xn, | ||
| size_t | xs, | ||
| float * | out, | ||
| size_t | on, | ||
| size_t | os, | ||
| float * | stage, | ||
| size_t | sn, | ||
| size_t | rows, | ||
| size_t | channels ) |
| int ck_linear_rows_sgemm_checked | ( | const float * | x, |
| size_t | xn, | ||
| const float * | w, | ||
| size_t | wn, | ||
| const float * | bias, | ||
| size_t | bn, | ||
| float * | out, | ||
| size_t | on, | ||
| float * | stage, | ||
| size_t | sn, | ||
| size_t | m, | ||
| size_t | k, | ||
| size_t | n ) |
Definition at line 45 of file linear_rows_sgemm_checked.c.
References bind_sgemm(), ck_checked_finite_bulk(), intersects(), once, sgemm, sgemm, and valid_region().
|
static |
Definition at line 149 of file linear_rows_sgemm_checked.c.
References bind_sgemm(), ck_checked_finite_bulk(), ck_checked_parallel_for(), ck_checked_span(), count, gelu_range(), intersects(), once, valid_region(), and vector_erf.
Referenced by ck_gelu_rows_vector_erf_f32(), and ck_gelu_rows_vector_erf_pool_f32().
|
static |
Definition at line 133 of file linear_rows_sgemm_checked.c.
References count, end, and vector_erf.
Referenced by gelu_impl().
|
static |
Definition at line 39 of file linear_rows_sgemm_checked.c.
Referenced by attention_impl(), ck_linear_rows_sgemm_checked(), and gelu_impl().
|
static |
Definition at line 33 of file linear_rows_sgemm_checked.c.
References count.
Referenced by attention_impl(), ck_linear_rows_sgemm_checked(), and gelu_impl().
|
static |
Definition at line 17 of file linear_rows_sgemm_checked.c.
Referenced by attention_impl(), ck_linear_rows_sgemm_checked(), and gelu_impl().
|
static |
Definition at line 14 of file linear_rows_sgemm_checked.c.
Referenced by attend_rows(), and ck_linear_rows_sgemm_checked().
|
static |
Definition at line 16 of file linear_rows_sgemm_checked.c.
Referenced by bind_sgemm(), gelu_impl(), and gelu_range().