← Back to C-Kernel-Engine Docs Doxygen Source Documentation
Loading...
Searching...
No Matches
checked_q4_k_activation.h
Go to the documentation of this file.
1#ifndef CK_CHECKED_Q4_K_ACTIVATION_H
2#define CK_CHECKED_Q4_K_ACTIVATION_H
3
4#include "ckernel_quant.h"
5
6#include <math.h>
7
8void gemv_q4_k_q8_k_avx2(float *, const void *, const void *, int, int);
9void gemv_q4_k_q8_k_pair_checked_cpu(float *, float *, const void *,
10 const void *, const void *, int, int);
11void quantize_row_q8_k_ref(const float *, void *, int);
12
13static inline int ck_pack_q4_input_q8_k(const float *input, unsigned char *packed, size_t width)
14{
15 for (size_t first = 0; first < width; first += QK_K) {
16 float maximum = 0.0f;
17 for (size_t i = 0; i < QK_K; ++i) maximum = fmaxf(maximum, fabsf(input[first + i]));
18 if (maximum != 0.0f && !isfinite(127.0f / maximum)) return -3;
19 }
20 quantize_row_q8_k_ref(input, packed, (int)width);
21 return 0;
22}
23
24#endif
void gemv_q4_k_q8_k_pair_checked_cpu(float *, float *, const void *, const void *, const void *, int, int)
void quantize_row_q8_k_ref(const float *, void *, int)
void gemv_q4_k_q8_k_avx2(float *, const void *, const void *, int, int)
static int ck_pack_q4_input_q8_k(const float *input, unsigned char *packed, size_t width)
Quantization block structures for weight-only quantization.
#define QK_K