FP32 API adapters that enforce Q8_0 x Q8_0 activation contract. More...
#include "ckernel_engine.h"#include "ckernel_quant.h"#include "ggml_runtime_compat.h"#include <dlfcn.h>#include <stdint.h>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>Go to the source code of this file.
Macros | |
| #define | _GNU_SOURCE |
| #define | CK_Q80_STACK_Q8_BLOCKS 1024 |
Typedefs | |
| typedef void(* | ck_q80_ggml_build_forward_expand_fn) (struct ggml_cgraph *, struct ggml_tensor *) |
| typedef void(* | ck_q80_ggml_cpu_init_fn) (void) |
| typedef void(* | ck_q80_ggml_free_fn) (struct ggml_context *) |
| typedef float *(* | ck_q80_ggml_get_data_f32_fn) (const struct ggml_tensor *) |
| typedef void *(* | ck_q80_ggml_get_data_fn) (const struct ggml_tensor *) |
| typedef enum ggml_status(* | ck_q80_ggml_graph_compute_with_ctx_fn) (struct ggml_context *, struct ggml_cgraph *, int) |
| typedef struct ggml_context *(* | ck_q80_ggml_init_fn) (struct ggml_init_params) |
| typedef struct ggml_tensor *(* | ck_q80_ggml_mul_mat_fn) (struct ggml_context *, struct ggml_tensor *, struct ggml_tensor *) |
| typedef size_t(* | ck_q80_ggml_nbytes_fn) (const struct ggml_tensor *) |
| typedef struct ggml_cgraph *(* | ck_q80_ggml_new_graph_fn) (struct ggml_context *) |
| typedef struct ggml_tensor *(* | ck_q80_ggml_new_tensor_2d_fn) (struct ggml_context *, enum ggml_type, int64_t, int64_t) |
Variables | |
| static int | ck_q80_contract_cached_gemm_seq = 0 |
| static const char | ck_q80_contract_magic [8] = {'C', 'K', 'D', 'M', 'P', '\0', '\0', '\0'} |
| static const uint32_t | ck_q80_contract_version = 1u |
FP32 API adapters that enforce Q8_0 x Q8_0 activation contract.
Definition in file gemm_kernels_q8_0_q8_0_contract.c.
| #define _GNU_SOURCE |
Definition at line 7 of file gemm_kernels_q8_0_q8_0_contract.c.
| #define CK_Q80_STACK_Q8_BLOCKS 1024 |
Definition at line 21 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef void(* ck_q80_ggml_build_forward_expand_fn) (struct ggml_cgraph *, struct ggml_tensor *) |
Definition at line 91 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef void(* ck_q80_ggml_cpu_init_fn) (void) |
Definition at line 93 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef void(* ck_q80_ggml_free_fn) (struct ggml_context *) |
Definition at line 87 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef float *(* ck_q80_ggml_get_data_f32_fn) (const struct ggml_tensor *) |
Definition at line 95 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef void *(* ck_q80_ggml_get_data_fn) (const struct ggml_tensor *) |
Definition at line 94 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef enum ggml_status(* ck_q80_ggml_graph_compute_with_ctx_fn) (struct ggml_context *, struct ggml_cgraph *, int) |
Definition at line 91 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef struct ggml_context *(* ck_q80_ggml_init_fn) (struct ggml_init_params) |
Definition at line 52 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef struct ggml_tensor *(* ck_q80_ggml_mul_mat_fn) (struct ggml_context *, struct ggml_tensor *, struct ggml_tensor *) |
Definition at line 87 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef size_t(* ck_q80_ggml_nbytes_fn) (const struct ggml_tensor *) |
Definition at line 96 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef struct ggml_cgraph *(* ck_q80_ggml_new_graph_fn) (struct ggml_context *) |
Definition at line 87 of file gemm_kernels_q8_0_q8_0_contract.c.
| typedef struct ggml_tensor *(* ck_q80_ggml_new_tensor_2d_fn) (struct ggml_context *, enum ggml_type, int64_t, int64_t) |
Definition at line 87 of file gemm_kernels_q8_0_q8_0_contract.c.
|
inlinestatic |
Definition at line 322 of file gemm_kernels_q8_0_q8_0_contract.c.
Referenced by quantize_row_q8_0_ref_local().
|
static |
Definition at line 46 of file gemm_kernels_q8_0_q8_0_contract.c.
Referenced by gemm_nt_q8_0_q8_0_contract().
|
static |
Definition at line 40 of file gemm_kernels_q8_0_q8_0_contract.c.
Referenced by gemm_nt_q8_0_q8_0_contract().
|
static |
Definition at line 52 of file gemm_kernels_q8_0_q8_0_contract.c.
References ck_q80_contract_magic, and ck_q80_contract_version.
Referenced by gemm_nt_q8_0_q8_0_contract().
|
static |
Definition at line 153 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 175 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 109 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 186 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 197 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 164 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 98 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 131 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 208 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 142 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
|
static |
Definition at line 120 of file gemm_kernels_q8_0_q8_0_contract.c.
References RTLD_DEFAULT.
Referenced by gemm_nt_q8_0_q8_0_ggml_strict().
| void gemm_nt_q8_0_q8_0_contract | ( | const float * | A, |
| const void * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 414 of file gemm_kernels_q8_0_q8_0_contract.c.
References C, ck_q80_contract_cached_gemm_seq, ck_q80_contract_cached_input_enabled(), ck_q80_contract_dump_enabled(), ck_q80_contract_dump_tensor(), ck_strict_consume_next_gemm_a(), ck_strict_parity_enabled(), gemm_nt_q8_0_q8_0_ggml_strict(), and gemv_q8_0_q8_0_contract().
|
static |
Definition at line 219 of file gemm_kernels_q8_0_q8_0_contract.c.
References C, ck_q80_resolve_ggml_build_forward_expand(), ck_q80_resolve_ggml_cpu_init(), ck_q80_resolve_ggml_free(), ck_q80_resolve_ggml_get_data(), ck_q80_resolve_ggml_get_data_f32(), ck_q80_resolve_ggml_graph_compute_with_ctx(), ck_q80_resolve_ggml_init(), ck_q80_resolve_ggml_mul_mat(), ck_q80_resolve_ggml_nbytes(), ck_q80_resolve_ggml_new_graph(), ck_q80_resolve_ggml_new_tensor_2d(), GGML_STATUS_SUCCESS, GGML_TYPE_F32, GGML_TYPE_Q8_0, and ggml_init_params::mem_size.
Referenced by gemm_nt_q8_0_q8_0_contract().
| void gemv_q8_0_q8_0_contract | ( | float * | y, |
| const void * | W, | ||
| const float * | x, | ||
| int | M, | ||
| int | K | ||
| ) |
Definition at line 383 of file gemm_kernels_q8_0_q8_0_contract.c.
References CK_Q80_STACK_Q8_BLOCKS, ck_strict_parity_enabled(), gemv_q8_0(), gemv_q8_0_q8_0_ref_rows(), gemv_q8_0_q8_0_x4(), QK8_0, quantize_row_q8_0(), and quantize_row_q8_0_ref_local().
Referenced by gemm_nt_q8_0_q8_0_contract().
|
static |
Definition at line 364 of file gemm_kernels_q8_0_q8_0_contract.c.
References QK8_0, and vec_dot_q8_0_q8_0_ref().
Referenced by gemv_q8_0_q8_0_contract().
|
static |
Definition at line 330 of file gemm_kernels_q8_0_q8_0_contract.c.
References CK_FP32_TO_FP16, ck_nearest_int_q8_0_ref(), block_q8_0::d, id, QK8_0, and block_q8_0::qs.
Referenced by gemv_q8_0_q8_0_contract().
| void vec_dot_q8_0_q8_0_ref | ( | int | n, |
| float * | s, | ||
| const void * | vx, | ||
| const void * | vy | ||
| ) |
Quantized dot product: Q8_0 weights x Q8_0 input (scalar reference)
| n | Number of elements (must be multiple of 32) |
| s | Output: scalar dot product result |
| vx | Q8_0 quantized weights |
| vy | Q8_0 quantized input |
Definition at line 1140 of file gemm_kernels_q8_0.c.
References CK_FP16_TO_FP32, QK8_0, and block_q8_0::qs.
Referenced by gemv_q8_0_q8_0_ref_rows(), and vec_dot_q8_0_q8_0().
|
static |
Definition at line 38 of file gemm_kernels_q8_0_q8_0_contract.c.
Referenced by gemm_nt_q8_0_q8_0_contract().
|
static |
Definition at line 36 of file gemm_kernels_q8_0_q8_0_contract.c.
Referenced by ck_q80_contract_dump_tensor().
|
static |
Definition at line 37 of file gemm_kernels_q8_0_q8_0_contract.c.
Referenced by ck_q80_contract_dump_tensor().