#include "ckernel_engine.h"#include "ck_threadpool.h"#include <dlfcn.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <errno.h>Go to the source code of this file.
Macros | |
| #define | CK_ADD_PAIR(pid, cid) |
Typedefs | |
| typedef size_t(* | ck_strict_mtmd_clip_embd_nbytes_by_img_fn) (void *, int, int) |
| typedef int(* | ck_strict_mtmd_clip_encode_float_image_fn) (void *, int, float *, int, int, float *) |
| typedef void(* | ck_strict_mtmd_clip_free_fn) (void *) |
| typedef void *(* | ck_strict_mtmd_clip_init_fn) (const char *, int, int, int, int, int) |
Functions | |
| int | ck_get_num_threads (void) |
| int | ck_get_physical_cores (void) |
| ck_threadpool_t * | ck_get_threadpool (void) |
| static int | ck_parse_env_int (const char *name) |
| void | ck_set_num_threads (int num_threads) |
| void | ck_set_strict_parity (int enabled) |
| const float * | ck_strict_consume_next_gemm_a (size_t elems) |
| int | ck_strict_mtmd_clip_encode_planar_f32 (const float *planar, int channels, int height, int width, float *out, size_t out_elems) |
| int | ck_strict_parity_enabled (void) |
| void | ck_strict_store_next_gemm_a (const float *data, size_t elems) |
| void | ck_threadpool_init (void) |
| void | ck_threadpool_shutdown (void) |
Variables | |
| static float * | ck_strict_next_gemm_a = NULL |
| static size_t | ck_strict_next_gemm_a_cap = 0 |
| static size_t | ck_strict_next_gemm_a_size = 0 |
| static int | ck_strict_next_gemm_a_valid = 0 |
| static int | ck_strict_parity = 0 |
| static int | g_num_threads = 0 |
| static int | g_threads_initialized = 0 |
| #define CK_ADD_PAIR | ( | pid, | |
| cid | |||
| ) |
| typedef size_t(* ck_strict_mtmd_clip_embd_nbytes_by_img_fn) (void *, int, int) |
Definition at line 81 of file ckernel_strict.c.
| typedef int(* ck_strict_mtmd_clip_encode_float_image_fn) (void *, int, float *, int, int, float *) |
Definition at line 82 of file ckernel_strict.c.
| typedef void(* ck_strict_mtmd_clip_free_fn) (void *) |
Definition at line 80 of file ckernel_strict.c.
| typedef void *(* ck_strict_mtmd_clip_init_fn) (const char *, int, int, int, int, int) |
Definition at line 79 of file ckernel_strict.c.
| int ck_get_num_threads | ( | void | ) |
Definition at line 310 of file ckernel_strict.c.
References ck_set_num_threads(), g_num_threads, and g_threads_initialized.
Referenced by attention_forward_decode_head_major_gqa_flash_f16cache_contract(), gemm_blocked_serial(), and global_pool_init().
| int ck_get_physical_cores | ( | void | ) |
Definition at line 170 of file ckernel_strict.c.
References CK_ADD_PAIR.
Referenced by ck_set_num_threads(), ck_threadpool_create_capacity(), and global_pool_init().
| ck_threadpool_t * ck_get_threadpool | ( | void | ) |
Get the global thread pool handle for dispatch. Convenience wrapper — initializes on first call.
Definition at line 350 of file ckernel_strict.c.
References ck_threadpool_global().
|
static |
Definition at line 153 of file ckernel_strict.c.
References end.
Referenced by ck_set_num_threads().
| void ck_set_num_threads | ( | int | num_threads | ) |
Definition at line 280 of file ckernel_strict.c.
References ck_get_physical_cores(), ck_parse_env_int(), g_num_threads, and g_threads_initialized.
Referenced by ck_get_num_threads().
| void ck_set_strict_parity | ( | int | enabled | ) |
Definition at line 28 of file ckernel_strict.c.
References ck_strict_next_gemm_a_size, ck_strict_next_gemm_a_valid, and ck_strict_parity.
| const float * ck_strict_consume_next_gemm_a | ( | size_t | elems | ) |
Definition at line 70 of file ckernel_strict.c.
References ck_strict_next_gemm_a, ck_strict_next_gemm_a_size, ck_strict_next_gemm_a_valid, and ck_strict_parity.
Referenced by gemm_nt_q8_0_q8_0_contract().
| int ck_strict_mtmd_clip_encode_planar_f32 | ( | const float * | planar, |
| int | channels, | ||
| int | height, | ||
| int | width, | ||
| float * | out, | ||
| size_t | out_elems | ||
| ) |
Definition at line 84 of file ckernel_strict.c.
| int ck_strict_parity_enabled | ( | void | ) |
Definition at line 43 of file ckernel_strict.c.
References ck_strict_parity.
Referenced by adamw_update_f32_impl(), attention_forward_decode_head_major_gqa_regular(), attention_forward_full_head_major_gqa_exact_strided(), attention_forward_full_head_major_gqa_ggml_strided_workspace(), attention_forward_head_major_gqa_flash_impl(), attention_forward_mixed_visual_chunk_head_major_gqa_flash_strided_gemma4_impl(), ck_dot_q6_k_q8_k_fast_or_ref(), ck_layer_forward_rmsnorm_swiglu(), ck_layer_forward_rmsnorm_swiglu_ref(), ck_mlp_swiglu_forward(), ck_mlp_swiglu_forward_ref(), ck_q6_k_q8_k_provider_name(), ck_q8k_activations_enabled(), gated_deltanet_autoregressive_forward(), gated_deltanet_impl_name(), geglu_forward_fp32(), gemm_avx512_parallel(), gemm_blocked_serial(), gemm_fine_grained_parallel(), gemm_naive_parallel(), gemm_nn_avx512(), gemm_nn_avx512_probe(), gemm_nn_blocked(), gemm_nn_parallel(), gemm_nt_f16(), gemm_nt_fp32_exact_parallel_dispatch(), gemm_nt_q6_k_q8_k_m4_tile(), gemm_nt_q8_0_q8_0_contract(), gemm_tn_avx512(), gemm_tn_blocked(), gemm_tn_parallel(), gemv_q4_k_q8_k_vnni(), gemv_q6_k_q8_k(), gemv_q6_k_q8_k_parallel_simd(), gemv_q8_0_q8_0_contract(), layernorm_forward_rolled_slice(), layernorm_forward_unrolled_slice(), mrope_qk_imrope_positions(), mrope_qk_vision(), rmsnorm_backward(), rmsnorm_forward_strided_f32(), softmax_cross_entropy_loss_index_mean_impl(), softmax_cross_entropy_loss_legacy_mean_impl(), swiglu_backward(), swiglu_forward(), and swiglu_forward_q8_k().
| void ck_strict_store_next_gemm_a | ( | const float * | data, |
| size_t | elems | ||
| ) |
Definition at line 48 of file ckernel_strict.c.
References ck_strict_next_gemm_a, ck_strict_next_gemm_a_cap, ck_strict_next_gemm_a_size, ck_strict_next_gemm_a_valid, and ck_strict_parity.
Referenced by ck_attention_full_ggml_graph_oracle_multihead().
| void ck_threadpool_init | ( | void | ) |
Initialize the global thread pool. Called once during engine startup (e.g., from ck_model_init). Uses ck_get_num_threads() for thread count (respects CK_NUM_THREADS env).
Safe to call multiple times — subsequent calls are no-ops.
Definition at line 330 of file ckernel_strict.c.
References ck_threadpool_global().
| void ck_threadpool_shutdown | ( | void | ) |
Shut down the global thread pool. Called during engine teardown. Workers are joined and freed.
Definition at line 341 of file ckernel_strict.c.
References ck_threadpool_global_destroy().
|
static |
Definition at line 23 of file ckernel_strict.c.
Referenced by ck_strict_consume_next_gemm_a(), and ck_strict_store_next_gemm_a().
|
static |
Definition at line 25 of file ckernel_strict.c.
Referenced by ck_strict_store_next_gemm_a().
|
static |
Definition at line 24 of file ckernel_strict.c.
Referenced by ck_set_strict_parity(), ck_strict_consume_next_gemm_a(), and ck_strict_store_next_gemm_a().
|
static |
Definition at line 26 of file ckernel_strict.c.
Referenced by ck_set_strict_parity(), ck_strict_consume_next_gemm_a(), and ck_strict_store_next_gemm_a().
|
static |
Definition at line 22 of file ckernel_strict.c.
Referenced by ck_set_strict_parity(), ck_strict_consume_next_gemm_a(), ck_strict_parity_enabled(), and ck_strict_store_next_gemm_a().
|
static |
Definition at line 150 of file ckernel_strict.c.
Referenced by ck_get_num_threads(), and ck_set_num_threads().
|
static |
Definition at line 151 of file ckernel_strict.c.
Referenced by ck_get_num_threads(), and ck_set_num_threads().