Persistent pthread thread pool for CK-Engine inference. More...
#include <stdint.h>#include <stdatomic.h>#include <pthread.h>Go to the source code of this file.
Data Structures | |
| struct | ck_threadpool_profile_t |
Macros | |
| #define | CK_CACHE_LINE 64 |
| #define | CK_THREADPOOL_MAX_THREADS 64 |
| #define | CK_THREADPOOL_SPIN_COUNT 1024 |
Typedefs | |
| typedef void(* | ck_range_fn_t) (int begin, int end, void *args) |
| typedef void(* | ck_work_fn_t) (int ith, int nth, void *args) |
Enumerations | |
| enum | ck_gemm_schedule_t { CK_GEMM_SCHEDULE_AUTO = 0 , CK_GEMM_SCHEDULE_STATIC = 1 , CK_GEMM_SCHEDULE_DYNAMIC = 2 } |
Functions | |
| int | ck_gemm_dynamic_schedule_enabled (void) |
| int | ck_get_gemm_schedule (void) |
| int | ck_set_gemm_schedule (int policy) |
| void | ck_threadpool_barrier (ck_threadpool_t *pool) |
| int | ck_threadpool_bounded_capacity (int default_threads, int logical_threads) |
| int | ck_threadpool_capacity (const ck_threadpool_t *pool) |
| ck_threadpool_t * | ck_threadpool_create (int n_threads) |
| ck_threadpool_t * | ck_threadpool_create_capacity (int default_threads, int capacity_threads) |
| void | ck_threadpool_destroy (ck_threadpool_t *pool) |
| void | ck_threadpool_dispatch (ck_threadpool_t *pool, ck_work_fn_t fn, void *args) |
| void | ck_threadpool_dispatch_n (ck_threadpool_t *pool, int active_threads, ck_work_fn_t fn, void *args) |
| ck_threadpool_t * | ck_threadpool_global (void) |
| void | ck_threadpool_global_destroy (void) |
| int | ck_threadpool_n_threads (const ck_threadpool_t *pool) |
| void | ck_threadpool_parallel_for_n (ck_threadpool_t *pool, int active_threads, int begin, int end, int grain_size, ck_range_fn_t fn, void *args) |
| void | ck_threadpool_pause (ck_threadpool_t *pool) |
| void | ck_threadpool_profile_reset (ck_threadpool_t *pool) |
| void | ck_threadpool_profile_snapshot (const ck_threadpool_t *pool, ck_threadpool_profile_t *profile) |
| void | ck_threadpool_resume (ck_threadpool_t *pool) |
| int | ck_threadpool_thread_id (const ck_threadpool_t *pool) |
Persistent pthread thread pool for CK-Engine inference.
Design goals:
Usage: ck_threadpool_t *pool = ck_threadpool_create(4); // 4 threads total
// In decode loop: ck_threadpool_dispatch(pool, my_work_fn, args); // my_work_fn called on all threads with (ith, nth, args)
// Between batches: ck_threadpool_pause(pool); // workers sleep (0% CPU) ck_threadpool_resume(pool); // wake workers
ck_threadpool_destroy(pool);
Architecture: STARTUP: Main creates N-1 worker pthreads, all spin on atomic counter DISPATCH: Main writes work desc, bumps counter, all threads execute BARRIER: Atomic counter + spin-wait with _mm_pause() PAUSE: Workers sleep on pthread_cond_t (0% CPU between batches)
Definition in file ck_threadpool.h.
| #define CK_CACHE_LINE 64 |
Cache line size for alignment (x86-64)
Definition at line 54 of file ck_threadpool.h.
| #define CK_THREADPOOL_MAX_THREADS 64 |
Maximum threads supported (main + workers)
Definition at line 48 of file ck_threadpool.h.
| #define CK_THREADPOOL_SPIN_COUNT 1024 |
Number of spin iterations before falling back to condvar wait
Definition at line 51 of file ck_threadpool.h.
| typedef void(* ck_range_fn_t) (int begin, int end, void *args) |
Process the half-open interval [begin, end).
Definition at line 86 of file ck_threadpool.h.
| typedef void(* ck_work_fn_t) (int ith, int nth, void *args) |
Work function signature. Called on ALL threads (including main thread 0).
| ith | Thread index (0 = main thread) |
| nth | Total number of threads |
| args | Opaque argument pointer (set via dispatch) |
Definition at line 68 of file ck_threadpool.h.
| enum ck_gemm_schedule_t |
Scheduling policy for independent GEMM output tiles.
| Enumerator | |
|---|---|
| CK_GEMM_SCHEDULE_AUTO | |
| CK_GEMM_SCHEDULE_STATIC | |
| CK_GEMM_SCHEDULE_DYNAMIC | |
Definition at line 89 of file ck_threadpool.h.
| int ck_gemm_dynamic_schedule_enabled | ( | void | ) |
Return non-zero when independent GEMM tiles should use dynamic claiming.
Definition at line 55 of file ck_threadpool.c.
References CK_GEMM_SCHEDULE_AUTO, CK_GEMM_SCHEDULE_DYNAMIC, and ck_get_gemm_schedule().
Referenced by gemm_nt_q4_k_packed_vnni_x8_q8_k_split_min_threaded_4m().
| int ck_get_gemm_schedule | ( | void | ) |
Return the configured process-wide GEMM scheduling policy.
Definition at line 50 of file ck_threadpool.c.
References g_gemm_schedule.
Referenced by ck_gemm_dynamic_schedule_enabled().
| int ck_set_gemm_schedule | ( | int | policy | ) |
Set the process-wide GEMM tile scheduling policy.
AUTO is the production default and currently selects dynamic work claiming for providers whose jobs write independent output tiles. Providers with ordered/shared reductions do not consult this policy.
Definition at line 41 of file ck_threadpool.c.
References CK_GEMM_SCHEDULE_DYNAMIC, and g_gemm_schedule.
| void ck_threadpool_barrier | ( | ck_threadpool_t * | pool | ) |
Barrier synchronization within a dispatched work function.
ALL threads must call this at the same point. Threads spin-wait until all have arrived, then proceed.
Must only be called from within a work function (during dispatch).
| pool | Thread pool |
Definition at line 520 of file ck_threadpool.c.
References barrier_wait().
| int ck_threadpool_bounded_capacity | ( | int | default_threads, |
| int | logical_threads | ||
| ) |
Compute the bounded capacity for an SMT-safe provider. The default width is preserved and at most half of the additional logical CPUs are reserved.
Definition at line 256 of file ck_threadpool.c.
References CK_THREADPOOL_MAX_THREADS.
Referenced by global_pool_init().
| int ck_threadpool_capacity | ( | const ck_threadpool_t * | pool | ) |
Get the maximum worker capacity available to explicit dispatch_n calls.
Definition at line 556 of file ck_threadpool.c.
Referenced by gemm_nt_q4_k_packed_vnni_x16_q8_k_split_min_threaded_16m(), and gemm_nt_q4_k_packed_vnni_x8_q8_k_split_min_threaded_4m().
| ck_threadpool_t * ck_threadpool_create | ( | int | n_threads | ) |
Create a thread pool with n_threads total threads. Thread 0 is the calling (main) thread; n_threads-1 workers are spawned.
| n_threads | Total thread count (including main). Must be >= 1. Pass 0 for auto-detect (physical cores). |
Definition at line 342 of file ck_threadpool.c.
References ck_threadpool_create_capacity().
| ck_threadpool_t * ck_threadpool_create_capacity | ( | int | default_threads, |
| int | capacity_threads | ||
| ) |
Create a pool whose ordinary dispatch width is smaller than its worker capacity. Exact providers may opt into the additional workers with ck_threadpool_dispatch_n(); ordinary dispatch remains at default_threads.
Definition at line 271 of file ck_threadpool.c.
References barrier_init(), CK_CACHE_LINE, ck_get_physical_cores(), CK_THREADPOOL_MAX_THREADS, and worker_main().
Referenced by ck_threadpool_create(), and global_pool_init().
| void ck_threadpool_destroy | ( | ck_threadpool_t * | pool | ) |
Destroy the thread pool. Signals all workers to exit and joins them. Safe to call with NULL.
Definition at line 347 of file ck_threadpool.c.
Referenced by ck_threadpool_global_destroy().
| void ck_threadpool_dispatch | ( | ck_threadpool_t * | pool, |
| ck_work_fn_t | fn, | ||
| void * | args | ||
| ) |
Dispatch work to all threads and wait for completion.
This is a blocking call — returns when ALL threads have finished.
| pool | Thread pool |
| fn | Work function (called on each thread) |
| args | Argument passed to fn |
Definition at line 465 of file ck_threadpool.c.
References ck_threadpool_dispatch_n().
| void ck_threadpool_dispatch_n | ( | ck_threadpool_t * | pool, |
| int | active_threads, | ||
| ck_work_fn_t | fn, | ||
| void * | args | ||
| ) |
Dispatch work to a subset of the pool and wait for completion.
Threads with ith >= active_threads remain idle for this dispatch. The work function sees nth == active_threads.
| pool | Thread pool |
| active_threads | Number of active threads including main thread |
| fn | Work function |
| args | Argument passed to fn |
Definition at line 375 of file ck_threadpool.c.
References barrier_init(), CK_SPIN_PAUSE, CK_THREADPOOL_SPIN_COUNT, and monotonic_ns().
Referenced by adamw_clip_update_multi_f32(), adamw_update_f32(), attention_forward_causal_head_major_gqa_flash_strided_f16kv_workspace(), attention_forward_causal_head_major_gqa_flash_strided_sliding(), attention_forward_causal_head_major_gqa_flash_strided_sliding_gemma4_impl(), attention_forward_causal_head_major_gqa_prefill_append_bf16cache_pytorch_contract_workspace(), attention_forward_causal_head_major_gqa_prefill_append_f16cache_gqa_reuse_config(), attention_forward_decode_head_major_gqa_flash_f16cache_split_partitioned(), attention_forward_head_major_gqa_flash_impl(), audio_conv1d_channel_major_f32(), ck_attention_f16_prefill_qtile64_dispatch(), ck_attention_forward_causal_head_major_gqa_prefill_segmented_f16cache_schedule_workspace(), ck_attention_forward_full_head_major_gqa_tiled_f16kv_fp32_strided(), ck_attention_forward_query_key_head_major_f32_run(), ck_attention_full_bf16_pytorch_flash(), ck_attention_full_bf16_sdpa_tiled(), ck_moe_q4k_mixed_parallel_workspace(), ck_moe_q4k_mixed_route_parallel(), ck_moe_q4k_q5k_route_parallel(), ck_moe_shared_gated_parallel_workspace(), ck_moe_shared_q4k_parallel_workspace(), ck_moe_swiglu_expert_forward_q4k_q5k_bucketed_impl(), ck_threadpool_dispatch(), ck_threadpool_parallel_for_n(), deepseek_mla_attention_f32_parallel_dispatch(), gemm_backward_f32_train_parallel_dispatch(), gemm_backward_f32_train_parallel_dispatch_v2(), gemm_blocked_serial_train_parallel_dispatch(), gemm_f16_input_fp16_threadpool(), gemm_nt_bf16_amx_bf16_storage_workspace(), gemm_nt_bf16_native_bf16_storage(), gemm_nt_q4_k_packed_meta_q8_k_threaded(), gemm_nt_q4_k_packed_meta_q8_k_threaded_nsplit(), gemm_nt_q4_k_packed_meta_x16_gateup_swiglu_fused_vnni(), gemm_nt_q4_k_packed_meta_x16_q8_k_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x16_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_4m(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_8m(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_nsplit(), gemm_nt_q4_k_packed_u8_x16_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_vnni_x16_q8_k_split_min_threaded_16m(), gemm_nt_q4_k_packed_vnni_x8_q8_k_split_min_threaded_4m(), gemm_nt_q4_k_q8_k_gateup_swiglu_fused_vnni(), gemm_q4_k_q8_k(), gradient_accumulate_f32(), gradient_accumulate_multi_f32(), gradient_clip_norm_f32(), gradient_global_norm_multi_f32(), gradient_scale_f32(), moe_swiglu_expert_forward_q4k_q5k_parallel_workspace(), and patch_projection_image_bf16_native_storage().
| ck_threadpool_t * ck_threadpool_global | ( | void | ) |
Get or create the global thread pool. Thread-safe (uses pthread_once internally). Uses ck_get_num_threads() for the default width. In automatic mode the pool may reserve a bounded subset of SMT siblings as explicit provider capacity; ordinary dispatch remains at the default width.
Definition at line 651 of file ck_threadpool.c.
References g_threadpool, g_threadpool_once, and global_pool_init().
Referenced by adamw_clip_update_multi_f32(), adamw_update_f32(), attention_forward_causal_head_major_gqa_flash_strided_f16kv_workspace(), attention_forward_causal_head_major_gqa_flash_strided_sliding(), attention_forward_causal_head_major_gqa_flash_strided_sliding_gemma4_impl(), attention_forward_causal_head_major_gqa_prefill_append_bf16cache_pytorch_contract_workspace(), attention_forward_causal_head_major_gqa_prefill_append_f16cache_auto_workspace(), attention_forward_causal_head_major_gqa_prefill_append_f16cache_gqa_reuse_config(), attention_forward_decode_head_major_gqa_flash_f16cache_split_partitioned(), attention_forward_head_major_gqa_flash_impl(), audio_conv1d_channel_major_f32(), audio_conv2d_whc_grouped_f32(), audio_glu_split_channel_major_f32(), audio_relative_shift_f32(), ck_attention_f16_prefill_qtile64_dispatch(), ck_attention_forward_causal_head_major_gqa_prefill_segmented_f16cache_schedule_workspace(), ck_attention_forward_full_head_major_gqa_tiled_f16kv_fp32_strided(), ck_attention_forward_query_key_head_major_f32_run(), ck_attention_full_bf16_pytorch_flash(), ck_attention_full_bf16_sdpa_tiled(), ck_gemma4_prepare_parallel(), ck_get_threadpool(), ck_moe_q4k_mixed_parallel_workspace(), ck_moe_shared_gated_parallel_workspace(), ck_moe_shared_q4k_parallel_workspace(), ck_moe_swiglu_expert_forward_q4k_q5k_bucketed_impl(), ck_threadpool_init(), deepseek_mla_attention_f32_parallel_dispatch(), deepseek_mla_kv_decompress_bf16_parallel_dispatch(), gemm_backward_f32_train_parallel_dispatch(), gemm_backward_f32_train_parallel_dispatch_v2(), gemm_blocked_serial_train_parallel_dispatch(), gemm_f16_input_fp16_threadpool(), gemm_nt_bf16_amx_bf16_storage_workspace(), gemm_nt_bf16_bf16_storage_parallel_dispatch(), gemm_nt_bf16_native_bf16_storage(), gemm_nt_bf16_parallel_dispatch(), gemm_nt_fp32_exact_parallel_dispatch(), gemm_nt_q4_k_packed_meta_q8_k_threaded(), gemm_nt_q4_k_packed_meta_q8_k_threaded_nsplit(), gemm_nt_q4_k_packed_meta_x16_gateup_swiglu_fused_vnni(), gemm_nt_q4_k_packed_meta_x16_q8_k_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x16_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_4m(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_8m(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_nsplit(), gemm_nt_q4_k_packed_u8_x16_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_vnni_x16_q8_k_split_min_threaded_16m(), gemm_nt_q4_k_packed_vnni_x8_q8_k_split_min_threaded_4m(), gemm_nt_q4_k_q8_k_gateup_swiglu_fused_vnni(), gemm_q4_k_q8_k(), gemma4_per_layer_embed_forward(), gemv_bf16_bf16_storage_parallel_dispatch(), gemv_bf16_parallel_dispatch(), gemv_nvfp4_q8_0_uniform(), gradient_accumulate_f32(), gradient_accumulate_multi_f32(), gradient_clip_norm_f32(), gradient_global_norm_multi_f32(), gradient_scale_f32(), moe_swiglu_expert_forward_q4k_q5k_parallel_workspace(), patch_projection_image_bf16_native_storage(), ssm_conv1d_forward_llama_fma(), and ssm_conv1d_forward_llama_production().
| void ck_threadpool_global_destroy | ( | void | ) |
Destroy the global thread pool. Called during engine shutdown.
Definition at line 657 of file ck_threadpool.c.
References ck_threadpool_destroy(), g_threadpool, and g_threadpool_once.
Referenced by ck_threadpool_shutdown().
| int ck_threadpool_n_threads | ( | const ck_threadpool_t * | pool | ) |
Get the ordinary/default dispatch width (including the main thread).
Definition at line 551 of file ck_threadpool.c.
Referenced by adamw_clip_update_multi_f32(), adamw_update_f32(), attention_forward_causal_head_major_gqa_flash_strided_f16kv_workspace(), attention_forward_causal_head_major_gqa_prefill_append_bf16cache_pytorch_contract_workspace(), attention_forward_causal_head_major_gqa_prefill_append_f16cache_auto_workspace(), attention_forward_causal_head_major_gqa_prefill_append_f16cache_gqa_reuse_config(), attention_forward_decode_head_major_gqa_flash_f16cache_split_partitioned(), audio_conv1d_channel_major_f32(), audio_conv2d_whc_grouped_f32(), audio_glu_split_channel_major_f32(), audio_relative_shift_f32(), ck_attention_f16_prefill_qtile64_dispatch(), ck_attention_forward_causal_head_major_gqa_prefill_segmented_f16cache_schedule_workspace(), ck_attention_forward_full_head_major_gqa_tiled_f16kv_fp32_strided(), ck_attention_forward_query_key_head_major_f32_run(), ck_attention_full_bf16_pytorch_flash(), ck_attention_full_bf16_sdpa_tiled(), ck_attention_pick_active_threads(), ck_gemm_f16_pick_active_threads(), ck_gemma4_prepare_parallel(), ck_moe_q4k_mixed_parallel_workspace(), ck_moe_q4k_mixed_route_parallel(), ck_moe_q4k_q5k_route_parallel(), ck_moe_shared_gated_parallel_workspace(), ck_moe_shared_q4k_parallel_workspace(), ck_moe_swiglu_expert_forward_q4k_q5k_bucketed_impl(), ck_sliding_attention_pick_threads(), deepseek_mla_attention_f32_parallel_dispatch(), deepseek_mla_kv_decompress_bf16_parallel_dispatch(), gemm_backward_f32_train_parallel_dispatch(), gemm_backward_f32_train_parallel_dispatch_v2(), gemm_blocked_serial_train_parallel_dispatch(), gemm_nt_bf16_amx_bf16_storage_workspace(), gemm_nt_bf16_bf16_storage_parallel_dispatch(), gemm_nt_bf16_native_bf16_storage(), gemm_nt_bf16_parallel_dispatch(), gemm_nt_fp32_exact_parallel_dispatch(), gemm_nt_q4_k_packed_meta_q8_k_threaded(), gemm_nt_q4_k_packed_meta_q8_k_threaded_nsplit(), gemm_nt_q4_k_packed_meta_x16_gateup_swiglu_fused_vnni(), gemm_nt_q4_k_packed_meta_x16_q8_k_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x16_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_4m(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_8m(), gemm_nt_q4_k_packed_meta_x8_q8_k_split_min_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_mreuse(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_mtile(), gemm_nt_q4_k_packed_meta_x8_q8_k_threaded_nsplit(), gemm_nt_q4_k_packed_u8_x16_q8_k_threaded_mtile(), gemm_nt_q4_k_q8_k_gateup_swiglu_fused_vnni(), gemm_q4_k_q8_k(), gemma4_per_layer_embed_forward(), gemv_bf16_bf16_storage_parallel_dispatch(), gemv_bf16_parallel_dispatch(), gemv_nvfp4_q8_0_uniform(), gradient_accumulate_f32(), gradient_accumulate_multi_f32(), gradient_clip_norm_f32(), gradient_global_norm_multi_f32(), gradient_scale_f32(), moe_swiglu_expert_forward_q4k_q5k_parallel_workspace(), patch_projection_image_bf16_native_storage(), ssm_conv1d_forward_llama_fma(), and ssm_conv1d_forward_llama_production().
| void ck_threadpool_parallel_for_n | ( | ck_threadpool_t * | pool, |
| int | active_threads, | ||
| int | begin, | ||
| int | end, | ||
| int | grain_size, | ||
| ck_range_fn_t | fn, | ||
| void * | args | ||
| ) |
Dynamically distribute independent ranges through the persistent pool.
Workers claim grain_size consecutive indices until [begin, end) is empty. This changes ownership only; callers remain responsible for ensuring that ranges write disjoint outputs and preserve each output's reduction order. Do not use this helper for unordered shared reductions.
Definition at line 494 of file ck_threadpool.c.
References ck_parallel_for_worker(), ck_threadpool_dispatch_n(), and end.
Referenced by audio_conv2d_whc_grouped_f32(), audio_glu_split_channel_major_f32(), audio_relative_shift_f32(), ck_gemma4_prepare_parallel(), deepseek_mla_kv_decompress_bf16_parallel_dispatch(), gemm_nt_bf16_bf16_storage_parallel_dispatch(), gemm_nt_bf16_parallel_dispatch(), gemm_nt_fp32_exact_parallel_dispatch(), gemm_nt_q4_k_packed_vnni_x8_q8_k_split_min_threaded_4m(), gemma4_per_layer_embed_forward(), gemv_bf16_bf16_storage_parallel_dispatch(), gemv_bf16_parallel_dispatch(), gemv_nvfp4_q8_0_uniform(), ssm_conv1d_forward_llama_fma(), and ssm_conv1d_forward_llama_production().
| void ck_threadpool_pause | ( | ck_threadpool_t * | pool | ) |
Pause workers — they sleep on condvar (0% CPU). Call between batches or during interactive waiting. Workers wake on next dispatch or resume.
Definition at line 530 of file ck_threadpool.c.
| void ck_threadpool_profile_reset | ( | ck_threadpool_t * | pool | ) |
Enable profiling and reset cumulative dispatch timing counters.
Definition at line 573 of file ck_threadpool.c.
| void ck_threadpool_profile_snapshot | ( | const ck_threadpool_t * | pool, |
| ck_threadpool_profile_t * | profile | ||
| ) |
Snapshot cumulative dispatch timing counters without stopping workers.
Definition at line 583 of file ck_threadpool.c.
References ck_threadpool_profile_t::completion_wait_ns, ck_threadpool_profile_t::dispatch_count, ck_threadpool_profile_t::dispatch_total_ns, and ck_threadpool_profile_t::main_work_ns.
| void ck_threadpool_resume | ( | ck_threadpool_t * | pool | ) |
Resume workers — transition from sleep to spin-wait. Call before starting a new batch of work.
Definition at line 536 of file ck_threadpool.c.
| int ck_threadpool_thread_id | ( | const ck_threadpool_t * | pool | ) |
Get thread index for current thread (0 = main, -1 if not in pool)
Definition at line 561 of file ck_threadpool.c.
Referenced by attention_forward_causal_head_major_gqa_prefill_append_bf16cache_pytorch_contract_workspace(), attention_forward_causal_head_major_gqa_prefill_append_f16cache_gqa_reuse_config(), ck_attention_f16_prefill_qtile64_dispatch(), ck_attention_forward_causal_head_major_gqa_prefill_segmented_f16cache_schedule_workspace(), and ck_sliding_attention_pick_threads().