← Back to C-Kernel-Engine Docs Doxygen Source Documentation
ckernel_mem_plan.h
Go to the documentation of this file.
1 #ifndef CKERNEL_MEM_PLAN_H
2 #define CKERNEL_MEM_PLAN_H
3 
4 #include "ckernel_ir_v2.h"
5 
6 #include <stddef.h>
7 
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11 
12 #define CK_MEM_PLAN_DEFAULT_ALIGN 64
13 
14 typedef enum {
20 
21 typedef struct CKMemSpan {
22  int buffer_id;
24  size_t offset_bytes;
25  size_t size_bytes;
26 } CKMemSpan;
27 
28 typedef struct CKMemPlan {
30  int num_spans;
33 } CKMemPlan;
34 
36  CKMemPlan *plan,
37  size_t alignment_bytes);
38 
40  CKMemPlan *plan,
41  size_t alignment_bytes);
42 
44  CKMemPlan *plan,
45  size_t alignment_bytes,
46  int tokens_override);
47 
49  CKMemPlan *plan,
50  size_t alignment_bytes,
51  int tokens_override);
52 
53 void ck_mem_plan_free(CKMemPlan *plan);
54 
55 #ifdef __cplusplus
56 } /* extern "C" */
57 #endif
58 
59 #endif /* CKERNEL_MEM_PLAN_H */
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)
CKMemArenaKind
@ CK_MEM_ARENA_GRADS
@ CK_MEM_ARENA_COUNT
@ CK_MEM_ARENA_WEIGHTS
@ CK_MEM_ARENA_ACTIVATIONS
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)
CKMemSpan * spans
size_t alignment_bytes
size_t total_bytes[CK_MEM_ARENA_COUNT]
size_t size_bytes
CKMemArenaKind arena
size_t offset_bytes