Go to the source code of this file.
Functions | |
| static size_t | align_up_bytes (size_t n, size_t align) |
| static size_t | align_up_elems (size_t elems, size_t elem_bytes, size_t align_bytes) |
| static CKMemArenaKind | arena_for_role (CKBufferRole role) |
| static int | buffer_enabled (const CKIRV2Graph *graph, const CKIRV2Buffer *buf, int training_enabled) |
| static int | build_plan (const CKIRV2Graph *graph, CKMemPlan *plan, size_t alignment_bytes, int training_enabled, int tokens_override) |
| int | ck_mem_plan_build_inference (const CKIRV2Graph *graph, CKMemPlan *plan, size_t alignment_bytes) |
| int | ck_mem_plan_build_inference_with_tokens (const CKIRV2Graph *graph, CKMemPlan *plan, size_t alignment_bytes, int tokens_override) |
| int | ck_mem_plan_build_training (const CKIRV2Graph *graph, CKMemPlan *plan, size_t alignment_bytes) |
| int | ck_mem_plan_build_training_with_tokens (const CKIRV2Graph *graph, CKMemPlan *plan, size_t alignment_bytes, int tokens_override) |
| void | ck_mem_plan_free (CKMemPlan *plan) |
| static int | find_buffer_by_name (const CKIRV2Graph *graph, const char *name) |
| static size_t | resolve_dim (const CKModelConfig *cfg, const CKIRV2AlignInfo *align, CKDimKind kind, int tokens_override) |
| static size_t | resolve_shape_elems (const CKModelConfig *cfg, const CKIRV2AlignInfo *align, const CKDimToken *shape, int tokens_override) |
|
static |
Definition at line 15 of file ckernel_mem_plan.c.
Referenced by align_up_elems(), and build_plan().
|
static |
Definition at line 21 of file ckernel_mem_plan.c.
References align_up_bytes().
Referenced by build_plan().
|
static |
Definition at line 84 of file ckernel_mem_plan.c.
References CK_MEM_ARENA_ACTIVATIONS, CK_MEM_ARENA_GRADS, CK_MEM_ARENA_WEIGHTS, CK_ROLE_ACTIVATION, CK_ROLE_GRAD, CK_ROLE_INPUT, CK_ROLE_OUTPUT, CK_ROLE_SCRATCH, and CK_ROLE_WEIGHT.
Referenced by build_plan().
|
static |
Definition at line 100 of file ckernel_mem_plan.c.
References CK_ROLE_GRAD, CKIRV2Buffer::condition, CKIRV2Graph::config, CKIRV2Graph::has_pos_emb, CKIRV2Buffer::role, and CKModelConfig::rope_theta.
Referenced by build_plan().
|
static |
Definition at line 146 of file ckernel_mem_plan.c.
References CKIRV2Buffer::alias_of, align_up_bytes(), align_up_elems(), CKMemPlan::alignment_bytes, CKMemSpan::arena, arena_for_role(), buffer_enabled(), CKMemSpan::buffer_id, CKIRV2Graph::buffers, ck_dtype_row_bytes(), CK_MEM_ARENA_COUNT, CK_MEM_PLAN_DEFAULT_ALIGN, CKIRV2Graph::config, CKModelConfig::context_window, CKIRV2Buffer::dtype, find_buffer_by_name(), CKModelConfig::hidden_size, CKModelConfig::intermediate_size, CKIRV2Graph::num_buffers, CKModelConfig::num_heads, CKMemPlan::num_spans, CKMemSpan::offset_bytes, resolve_shape_elems(), CKIRV2Buffer::role, CKIRV2Buffer::shape, CKMemSpan::size_bytes, CKMemPlan::spans, and CKMemPlan::total_bytes.
Referenced by ck_mem_plan_build_inference(), ck_mem_plan_build_inference_with_tokens(), ck_mem_plan_build_training(), and ck_mem_plan_build_training_with_tokens().
| int ck_mem_plan_build_inference | ( | const CKIRV2Graph * | graph, |
| CKMemPlan * | plan, | ||
| size_t | alignment_bytes | ||
| ) |
Definition at line 216 of file ckernel_mem_plan.c.
References build_plan().
| int ck_mem_plan_build_inference_with_tokens | ( | const CKIRV2Graph * | graph, |
| CKMemPlan * | plan, | ||
| size_t | alignment_bytes, | ||
| int | tokens_override | ||
| ) |
Definition at line 230 of file ckernel_mem_plan.c.
References build_plan().
Referenced by ck_codegen_v2_emit_runtime(), and ck_ir_v2_lower_graph().
| int ck_mem_plan_build_training | ( | const CKIRV2Graph * | graph, |
| CKMemPlan * | plan, | ||
| size_t | alignment_bytes | ||
| ) |
Definition at line 223 of file ckernel_mem_plan.c.
References build_plan().
| int ck_mem_plan_build_training_with_tokens | ( | const CKIRV2Graph * | graph, |
| CKMemPlan * | plan, | ||
| size_t | alignment_bytes, | ||
| int | tokens_override | ||
| ) |
Definition at line 238 of file ckernel_mem_plan.c.
References build_plan().
Referenced by ck_codegen_v2_emit_runtime(), and ck_ir_v2_lower_graph().
| void ck_mem_plan_free | ( | CKMemPlan * | plan | ) |
Definition at line 246 of file ckernel_mem_plan.c.
References CKMemPlan::spans.
Referenced by ck_codegen_v2_emit_runtime(), ck_ir_v2_lower_emit_json(), and ck_ir_v2_lower_graph().
|
static |
Definition at line 133 of file ckernel_mem_plan.c.
References CKIRV2Graph::buffers, CKIRV2Buffer::name, and CKIRV2Graph::num_buffers.
Referenced by build_plan().
|
static |
Definition at line 28 of file ckernel_mem_plan.c.
References CK_DIM_ALIGNED_CTX, CK_DIM_ALIGNED_EMBED, CK_DIM_ALIGNED_HEAD, CK_DIM_ALIGNED_INTERMEDIATE, CK_DIM_EMBED, CK_DIM_END, CK_DIM_HEAD_DIM, CK_DIM_INTERMEDIATE, CK_DIM_NUM_HEADS, CK_DIM_NUM_KV_HEADS, CK_DIM_TOKENS, CK_DIM_VOCAB, CKModelConfig::context_window, CKModelConfig::hidden_size, CKModelConfig::intermediate_size, CKModelConfig::num_heads, CKModelConfig::num_kv_heads, and CKModelConfig::vocab_size.
Referenced by resolve_shape_elems().
|
static |
Definition at line 65 of file ckernel_mem_plan.c.
References CK_DIM_END, CK_IR_V2_MAX_DIMS, and resolve_dim().
Referenced by build_plan().