char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
bec4772f6
char/aliceai-t5-moe
1#pragma once 2 3#define GGML_COMMON_DECL_C 4#include "ggml-common.h" 5 6#include "ggml.h" 7 8// GGML internal header 9 10#ifdef __cplusplus 11extern "C" { 12#endif 13 14// NOTE: these functions are defined as GGML_API because they used by the CPU backend 15 16// Quantization 17GGML_API void quantize_row_q1_0_ref (const float * GGML_RESTRICT x ,block_q1_0 * GGML_RESTRICT y ,int64_t k ); 18GGML_API void quantize_row_q2_0_ref (const float * GGML_RESTRICT x ,block_q2_0 * GGML_RESTRICT y ,int64_t k ); 19GGML_API void quantize_row_q4_0_ref (const float * GGML_RESTRICT x ,block_q4_0 * GGML_RESTRICT y ,int64_t k ); 20GGML_API void quantize_row_q4_1_ref (const float * GGML_RESTRICT x ,block_q4_1 * GGML_RESTRICT y ,int64_t k ); 21GGML_API void quantize_row_q5_0_ref (const float * GGML_RESTRICT x ,block_q5_0 * GGML_RESTRICT y ,int64_t k ); 22GGML_API void quantize_row_q5_1_ref (const float * GGML_RESTRICT x ,block_q5_1 * GGML_RESTRICT y ,int64_t k ); 23GGML_API void quantize_row_q8_0_ref (const float * GGML_RESTRICT x ,block_q8_0 * GGML_RESTRICT y ,int64_t k ); 24GGML_API void quantize_row_q8_1_ref (const float * GGML_RESTRICT x ,block_q8_1 * GGML_RESTRICT y ,int64_t k ); 25 26GGML_API void quantize_row_mxfp4_ref (const float * GGML_RESTRICT x ,block_mxfp4 * GGML_RESTRICT y ,int64_t k ); 27GGML_API void quantize_row_nvfp4_ref (const float * GGML_RESTRICT x ,block_nvfp4 * GGML_RESTRICT y ,int64_t k ); 28 29GGML_API void quantize_row_q2_K_ref (const float * GGML_RESTRICT x ,block_q2_K * GGML_RESTRICT y ,int64_t k ); 30GGML_API void quantize_row_q3_K_ref (const float * GGML_RESTRICT x ,block_q3_K * GGML_RESTRICT y ,int64_t k ); 31GGML_API void quantize_row_q4_K_ref (const float * GGML_RESTRICT x ,block_q4_K * GGML_RESTRICT y ,int64_t k ); 32GGML_API void quantize_row_q5_K_ref (const float * GGML_RESTRICT x ,block_q5_K * GGML_RESTRICT y ,int64_t k ); 33GGML_API void quantize_row_q6_K_ref (const float * GGML_RESTRICT x ,block_q6_K * GGML_RESTRICT y ,int64_t k ); 34GGML_API void quantize_row_q8_K_ref (const float * GGML_RESTRICT x ,block_q8_K * GGML_RESTRICT y ,int64_t k ); 35 36GGML_API void quantize_row_tq1_0_ref (const float * GGML_RESTRICT x ,block_tq1_0 * GGML_RESTRICT y ,int64_t k ); 37GGML_API void quantize_row_tq2_0_ref (const float * GGML_RESTRICT x ,block_tq2_0 * GGML_RESTRICT y ,int64_t k ); 38 39GGML_API void quantize_row_iq3_xxs_ref (const float * GGML_RESTRICT x ,block_iq3_xxs * GGML_RESTRICT y ,int64_t k ); 40GGML_API void quantize_row_iq4_nl_ref (const float * GGML_RESTRICT x ,block_iq4_nl * GGML_RESTRICT y ,int64_t k ); 41GGML_API void quantize_row_iq4_xs_ref (const float * GGML_RESTRICT x ,block_iq4_xs * GGML_RESTRICT y ,int64_t k ); 42GGML_API void quantize_row_iq3_s_ref (const float * GGML_RESTRICT x ,block_iq3_s * GGML_RESTRICT y ,int64_t k ); 43GGML_API void quantize_row_iq2_s_ref (const float * GGML_RESTRICT x ,block_iq2_s * GGML_RESTRICT y ,int64_t k ); 44 45// Dequantization 46GGML_API void dequantize_row_q1_0 (const block_q1_0 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 47GGML_API void dequantize_row_q2_0 (const block_q2_0 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 48GGML_API void dequantize_row_q4_0 (const block_q4_0 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 49GGML_API void dequantize_row_q4_1 (const block_q4_1 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 50GGML_API void dequantize_row_q5_0 (const block_q5_0 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 51GGML_API void dequantize_row_q5_1 (const block_q5_1 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 52GGML_API void dequantize_row_q8_0 (const block_q8_0 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 53//GGML_API void dequantize_row_q8_1(const block_q8_1 * GGML_RESTRICT x, float * GGML_RESTRICT y, int64_t k); 54 55GGML_API void dequantize_row_mxfp4 (const block_mxfp4 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 56GGML_API void dequantize_row_nvfp4 (const block_nvfp4 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 57 58GGML_API void dequantize_row_q2_K (const block_q2_K * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 59GGML_API void dequantize_row_q3_K (const block_q3_K * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 60GGML_API void dequantize_row_q4_K (const block_q4_K * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 61GGML_API void dequantize_row_q5_K (const block_q5_K * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 62GGML_API void dequantize_row_q6_K (const block_q6_K * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 63GGML_API void dequantize_row_q8_K (const block_q8_K * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 64 65GGML_API void dequantize_row_tq1_0 (const block_tq1_0 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 66GGML_API void dequantize_row_tq2_0 (const block_tq2_0 * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 67 68GGML_API void dequantize_row_iq2_xxs (const block_iq2_xxs * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 69GGML_API void dequantize_row_iq2_xs (const block_iq2_xs * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 70GGML_API void dequantize_row_iq2_s (const block_iq2_s * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 71GGML_API void dequantize_row_iq3_xxs (const block_iq3_xxs * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 72GGML_API void dequantize_row_iq1_s (const block_iq1_s * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 73GGML_API void dequantize_row_iq1_m (const block_iq1_m * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 74GGML_API void dequantize_row_iq4_nl (const block_iq4_nl * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 75GGML_API void dequantize_row_iq4_xs (const block_iq4_xs * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 76GGML_API void dequantize_row_iq3_s (const block_iq3_s * GGML_RESTRICT x ,float * GGML_RESTRICT y ,int64_t k ); 77 78// Quantization utilizing an importance matrix (a.k.a. "Activation aWare Quantization") 79GGML_API size_t quantize_iq2_xxs (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 80GGML_API size_t quantize_iq2_xs (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 81GGML_API size_t quantize_iq2_s (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 82GGML_API size_t quantize_iq3_xxs (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 83GGML_API size_t quantize_iq1_s (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 84GGML_API size_t quantize_iq1_m (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 85GGML_API size_t quantize_iq4_nl (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 86GGML_API size_t quantize_iq4_xs (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 87GGML_API size_t quantize_iq3_s (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 88 89GGML_API size_t quantize_tq1_0 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 90GGML_API size_t quantize_tq2_0 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 91 92GGML_API size_t quantize_q2_K (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 93GGML_API size_t quantize_q3_K (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 94GGML_API size_t quantize_q4_K (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 95GGML_API size_t quantize_q5_K (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 96GGML_API size_t quantize_q6_K (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 97GGML_API size_t quantize_q1_0 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 98GGML_API size_t quantize_q2_0 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 99GGML_API size_t quantize_q4_0 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 100GGML_API size_t quantize_q4_1 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 101GGML_API size_t quantize_q5_0 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 102GGML_API size_t quantize_q5_1 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 103GGML_API size_t quantize_q8_0 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 104 105GGML_API size_t quantize_mxfp4 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 106GGML_API size_t quantize_nvfp4 (const float * GGML_RESTRICT src ,void * GGML_RESTRICT dst ,int64_t nrows ,int64_t n_per_row ,const float * imatrix ); 107 108GGML_API void iq2xs_init_impl (enum ggml_type type ); 109GGML_API void iq2xs_free_impl (enum ggml_type type ); 110GGML_API void iq3xs_init_impl (int grid_size ); 111GGML_API void iq3xs_free_impl (int grid_size ); 112 113#ifdef __cplusplus 114} 115#endif