General matrix multiply (GEMM) kernels with SIMD (SSE/AVX/AVX512) More...
Go to the source code of this file.
Functions | |
| static void | ck_gemm_add_bias (float *C, const float *bias, int M, int N) |
| static int | ck_gemm_nn_impl_probe_enabled (void) |
| static void | ck_gemm_nt_f32_llama_production_output (const float *A, const float *B, const float *bias, float *C, int M, int N, int K, int index) |
| static void | ck_gemm_nt_fp32_exact_rows (int begin, int end, void *opaque) |
| static int | ck_min (int a, int b) |
| void | gemm_avx512_parallel (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_blocked_serial (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_fine_grained_parallel (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_naive_parallel (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| static void | gemm_naive_serial_double (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| static void | gemm_naive_serial_float (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_nn_avx512 (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_nn_avx512_probe (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_nn_blocked (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_nn_parallel (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| static void | gemm_nn_serial_double (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_nn_simd (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_nt_f32_llama_production (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_nt_f32_llama_production_output_range (const float *A, const float *B, const float *bias, float *C, int M, int N, int K, int output_begin, int output_end) |
| void | gemm_nt_fp32_exact_parallel_dispatch (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| static void | gemm_nt_matvec_parallel (const float *A, const float *B, const float *bias, float *C, int N, int K) |
| void | gemm_tn_avx512 (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_tn_blocked (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| void | gemm_tn_parallel (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
| static void | gemm_tn_serial_double (const float *A, const float *B, const float *bias, float *C, int M, int N, int K) |
General matrix multiply (GEMM) kernels with SIMD (SSE/AVX/AVX512)
After changes: make test && make llamacpp-parity-full
LEGACY EXCEPTION: This file contains OpenMP for backward compatibility. New kernels should NOT use OpenMP internally.
GEMM: C = alpha * A @ B + beta * C (with optional bias)
Definition in file gemm_kernels.c.
|
inlinestatic |
Definition at line 33 of file gemm_kernels.c.
References C.
Referenced by gemm_blocked_serial().
|
static |
Definition at line 556 of file gemm_kernels.c.
Referenced by gemm_nn_simd().
|
inlinestatic |
Definition at line 965 of file gemm_kernels.c.
References C.
Referenced by gemm_nt_f32_llama_production(), and gemm_nt_f32_llama_production_output_range().
|
static |
Definition at line 157 of file gemm_kernels.c.
References end.
Referenced by gemm_nt_fp32_exact_parallel_dispatch().
|
inlinestatic |
Definition at line 31 of file gemm_kernels.c.
Referenced by gemm_blocked_serial(), gemm_fine_grained_parallel(), gemm_nn_blocked(), and gemm_tn_blocked().
| void gemm_avx512_parallel | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 230 of file gemm_kernels.c.
References C, ck_strict_parity_enabled(), gemm_naive_parallel(), and gemm_naive_serial_float().
| void gemm_blocked_serial | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 849 of file gemm_kernels.c.
References C, ck_gemm_add_bias(), ck_get_num_threads(), ck_min(), ck_strict_parity_enabled(), gemm_microkernel(), gemm_naive_serial_float(), and gemm_nt_matvec_parallel().
Referenced by ck_attention_project_head_major(), ck_gemm_nt_quant(), ck_mlp_swiglu_forward(), ck_mlp_swiglu_forward_fused_token(), ck_qkv_project_head_major(), ck_qkv_project_head_major_token(), ck_train_gemm_work(), gemm_blocked_serial_train_parallel_dispatch(), mlp_token_parallel(), and mlp_token_parallel_exact().
| void gemm_fine_grained_parallel | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 286 of file gemm_kernels.c.
References C, ck_min(), ck_strict_parity_enabled(), gemm_naive_parallel(), and gemm_naive_serial_float().
| void gemm_naive_parallel | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 206 of file gemm_kernels.c.
References C, ck_strict_parity_enabled(), and gemm_naive_serial_float().
Referenced by ck_attention_project_head_major_ref(), ck_mlp_swiglu_forward_ref(), ck_qkv_project_head_major_ref(), gemm_avx512_parallel(), and gemm_fine_grained_parallel().
|
static |
Definition at line 112 of file gemm_kernels.c.
References C.
|
static |
Definition at line 129 of file gemm_kernels.c.
References C.
Referenced by gemm_avx512_parallel(), gemm_blocked_serial(), gemm_fine_grained_parallel(), and gemm_naive_parallel().
| void gemm_nn_avx512 | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 420 of file gemm_kernels.c.
References C, ck_strict_parity_enabled(), gemm_nn_parallel(), and gemm_nn_serial_double().
Referenced by gemm_nn_simd().
| void gemm_nn_avx512_probe | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 493 of file gemm_kernels.c.
References C, ck_strict_parity_enabled(), gemm_nn_parallel(), and gemm_nn_serial_double().
Referenced by gemm_nn_simd().
| void gemm_nn_blocked | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 590 of file gemm_kernels.c.
References C, ck_min(), ck_strict_parity_enabled(), and gemm_nn_serial_double().
| void gemm_nn_parallel | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 398 of file gemm_kernels.c.
References C, ck_strict_parity_enabled(), and gemm_nn_serial_double().
Referenced by gemm_nn_avx512(), and gemm_nn_avx512_probe().
|
static |
Definition at line 381 of file gemm_kernels.c.
References C.
Referenced by gemm_nn_avx512(), gemm_nn_avx512_probe(), gemm_nn_blocked(), and gemm_nn_parallel().
| void gemm_nn_simd | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 577 of file gemm_kernels.c.
References C, ck_gemm_nn_impl_probe_enabled(), gemm_nn_avx512(), and gemm_nn_avx512_probe().
Referenced by fc1_backward_kernel(), fc2_backward_kernel(), gemm_backward_f32_train_parallel_dispatch(), and gemm_backward_f32_train_parallel_dispatch_v2().
| void gemm_nt_f32_llama_production | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 1062 of file gemm_kernels.c.
References C, and ck_gemm_nt_f32_llama_production_output().
Referenced by ck_moe_shared_q4k_gated_workspace(), and moe_swiglu_shared_forward_q8_0_gated_workspace().
| void gemm_nt_f32_llama_production_output_range | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K, | ||
| int | output_begin, | ||
| int | output_end | ||
| ) |
Definition at line 1049 of file gemm_kernels.c.
References C, and ck_gemm_nt_f32_llama_production_output().
| void gemm_nt_fp32_exact_parallel_dispatch | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 179 of file gemm_kernels.c.
References C, ck_gemm_nt_fp32_exact_rows(), ck_strict_parity_enabled(), ck_threadpool_global(), ck_threadpool_n_threads(), and ck_threadpool_parallel_for_n().
|
static |
Definition at line 66 of file gemm_kernels.c.
References C.
Referenced by gemm_blocked_serial().
| void gemm_tn_avx512 | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 709 of file gemm_kernels.c.
References C, ck_strict_parity_enabled(), gemm_tn_parallel(), and gemm_tn_serial_double().
| void gemm_tn_blocked | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 769 of file gemm_kernels.c.
References C, ck_min(), ck_strict_parity_enabled(), and gemm_tn_serial_double().
| void gemm_tn_parallel | ( | const float * | A, |
| const float * | B, | ||
| const float * | bias, | ||
| float * | C, | ||
| int | M, | ||
| int | N, | ||
| int | K | ||
| ) |
Definition at line 687 of file gemm_kernels.c.
References C, ck_strict_parity_enabled(), and gemm_tn_serial_double().
Referenced by fc1_backward_kernel(), fc2_backward_kernel(), and gemm_tn_avx512().
|
static |
Definition at line 669 of file gemm_kernels.c.
References C.
Referenced by gemm_tn_avx512(), gemm_tn_blocked(), and gemm_tn_parallel().