char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

BartowskiAVX2: Speed up large batch size prompt processing of IQ models (#27402)85c55223c

char/aliceai-t5-moe
1.7 KiB39 linesraw
1#pragma once
2
3#include "ggml-cpu-impl.h"
4#include "ggml.h"
5
6// GGML internal header
7
8// batched mul_mat path for the grid based IQ types: decode 8 src0 rows at a time into per thread scratch
9// (block_iqp_x8, see iqp.cpp) and run an integer gemm over them against all src1 columns
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15// whether cne1 rows of src1 are enough for the decode to pay for itself, per expert, for MUL_MAT_ID
16bool ggml_cpu_iqp_mul_mat_id_min_batch(int64_t cne1);
17
18bool ggml_cpu_iqp_supports_mul_mat(const struct ggml_tensor * dst);
19
20// node level test only - per expert eligibility is decided with ggml_cpu_iqp_mul_mat_id_min_batch
21bool ggml_cpu_iqp_supports_mul_mat_id(const struct ggml_tensor * dst);
22
23// per thread panel scratch bytes, padded
24size_t ggml_cpu_iqp_scratch_size(const struct ggml_tensor * dst);
25
26// must be called after src1 has been converted to q8_K into params->wdata and the threads have synchronized on it
27void ggml_compute_forward_mul_mat_iqp(const struct ggml_compute_params * params, struct ggml_tensor * dst);
28
29// one expert: expert_rows points at its row of the matrix_rows table of (i1, i2) int32 pairs, panels at the base of the per thread panel scratches
30void ggml_compute_forward_mul_mat_id_iqp(const struct ggml_compute_params * params,
31                                         struct ggml_tensor *               dst,
32                                         int64_t                            cur_a,
33                                         int64_t                            cne1,
34                                         const int32_t *                    expert_rows,
35                                         void *                             panels);
36
37#ifdef __cplusplus
38}
39#endif