#include <dlfcn.h>#include <limits.h>#include <pthread.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <stddef.h>#include <stdint.h>#include <stdatomic.h>#include "bf16_utils.h"#include "checked_parallel.h"Go to the source code of this file.
Macros | |
| #define | _GNU_SOURCE |
Typedefs | |
| typedef void(* | ck_bf16_gemm_fn) (int, int, int, int, int, int, float, const uint16_t *, int, const uint16_t *, int, float, float *, int) |
| typedef void(* | ck_dgemm_fn) (const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *) |
Functions | |
| static void | bind_bf16_gemm (void) |
| static void | bind_dgemm (void) |
| int | ck_indexed_linear_rows_bf16_checked (const uint16_t *input, size_t input_elements, const int32_t *indices, size_t index_elements, const uint16_t *weight, size_t weight_elements, const uint16_t *bias, size_t bias_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, size_t banks) |
| 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) |
| 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) |
| 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) |
| int | ck_linear_rows_bf16_packed_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, size_t pair_chunk) |
| int | ck_linear_rows_bias_bf16_checked (const uint16_t *input, size_t input_elements, const uint16_t *weight, size_t weight_elements, const uint16_t *bias, size_t bias_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) |
| static int | linear_rows_bf16_checked (const uint16_t *input, size_t input_elements, const uint16_t *weight, size_t weight_elements, const uint16_t *bias, size_t bias_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) |
| static int | overlap (const uint16_t *a, size_t a_count, const uint16_t *b, size_t b_count) |
| static void | project_ordered_tiles (size_t begin, size_t end, void *opaque) |
| static int | region_valid (const uint16_t *ptr, size_t elements) |
| static int | stage_ordered_row (struct ordered_projection *p, size_t row, size_t start, size_t lanes, const double *sums) |
Variables | |
| static ck_bf16_gemm_fn | bf16_gemm |
| static pthread_once_t | bf16_gemm_once = PTHREAD_ONCE_INIT |
| static ck_dgemm_fn | dgemm |
| static pthread_once_t | dgemm_once = PTHREAD_ONCE_INIT |
| #define _GNU_SOURCE |
Definition at line 2 of file linear_rows_bf16_checked.c.
| typedef void(* ck_bf16_gemm_fn) (int, int, int, int, int, int, float, const uint16_t *, int, const uint16_t *, int, float, float *, int) |
Definition at line 579 of file linear_rows_bf16_checked.c.
| typedef void(* ck_dgemm_fn) (const char *, const char *, const int *, const int *, const int *, const double *, const double *, const int *, const double *, const int *, const double *, double *, const int *) |
Definition at line 505 of file linear_rows_bf16_checked.c.
|
static |
Definition at line 585 of file linear_rows_bf16_checked.c.
References bf16_gemm, and RTLD_DEFAULT.
Referenced by ck_linear_rows_bf16_cblas_checked().
|
static |
Definition at line 512 of file linear_rows_bf16_checked.c.
References dgemm, and RTLD_DEFAULT.
Referenced by ck_linear_rows_bf16_blas_checked().
| int ck_indexed_linear_rows_bf16_checked | ( | const uint16_t * | input, |
| size_t | input_elements, | ||
| const int32_t * | indices, | ||
| size_t | index_elements, | ||
| const uint16_t * | weight, | ||
| size_t | weight_elements, | ||
| const uint16_t * | bias, | ||
| size_t | bias_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, | ||
| size_t | banks ) |
Definition at line 738 of file linear_rows_bf16_checked.c.
References bf16_to_float(), dot(), float_to_bf16(), ids, overlap(), product(), and region_valid().
| 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_linear_rows_bf16_packed_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, | ||
| size_t | pair_chunk ) |
Definition at line 693 of file linear_rows_bf16_checked.c.
References bf16_to_float(), ck_checked_parallel_for(), overlap(), and region_valid().
| int ck_linear_rows_bias_bf16_checked | ( | const uint16_t * | input, |
| size_t | input_elements, | ||
| const uint16_t * | weight, | ||
| size_t | weight_elements, | ||
| const uint16_t * | bias, | ||
| size_t | bias_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 491 of file linear_rows_bf16_checked.c.
References linear_rows_bf16_checked().
|
static |
Definition at line 414 of file linear_rows_bf16_checked.c.
References bf16_to_float(), ck_checked_parallel_for(), overlap(), project(), project_ordered_tiles(), and region_valid().
Referenced by ck_linear_rows_bf16_checked(), and ck_linear_rows_bias_bf16_checked().
|
static |
Definition at line 30 of file linear_rows_bf16_checked.c.
Referenced by ck_indexed_linear_rows_bf16_checked(), ck_linear_rows_bf16_blas_checked(), ck_linear_rows_bf16_cblas_checked(), ck_linear_rows_bf16_packed_checked(), and linear_rows_bf16_checked().
|
static |
Definition at line 205 of file linear_rows_bf16_checked.c.
References bf16_to_float(), end, stage_ordered_row(), and start.
Referenced by linear_rows_bf16_checked().
|
static |
Definition at line 23 of file linear_rows_bf16_checked.c.
Referenced by ck_indexed_linear_rows_bf16_checked(), ck_linear_rows_bf16_blas_checked(), ck_linear_rows_bf16_cblas_checked(), ck_linear_rows_bf16_packed_checked(), and linear_rows_bf16_checked().
|
static |
Definition at line 46 of file linear_rows_bf16_checked.c.
References bf16_to_float(), float_to_bf16(), and start.
Referenced by project_ordered_tiles().
|
static |
Definition at line 583 of file linear_rows_bf16_checked.c.
Referenced by bind_bf16_gemm(), and ck_linear_rows_bf16_cblas_checked().
|
static |
Definition at line 582 of file linear_rows_bf16_checked.c.
Referenced by ck_linear_rows_bf16_cblas_checked().
|
static |
Definition at line 510 of file linear_rows_bf16_checked.c.
Referenced by bind_dgemm(), and ck_linear_rows_bf16_blas_checked().
|
static |
Definition at line 509 of file linear_rows_bf16_checked.c.
Referenced by ck_linear_rows_bf16_blas_checked().