← Back to C-Kernel-Engine Docs Doxygen Source Documentation
ckernel_bump_v5.h
Go to the documentation of this file.
1 #ifndef CKERNEL_BUMP_V5_H
2 #define CKERNEL_BUMP_V5_H
3 
4 /*
5  * BUMPWGT5 format definition (v6.6).
6  *
7  * Design goals:
8  * - Preserve existing weight offsets (payload layout unchanged).
9  * - Append metadata at EOF with a footer for discovery.
10  * - Keep BUMPWGT4-compatible header size (128 bytes).
11  */
12 
13 #include <stdint.h>
14 
15 #define CK_BUMP_MAGIC_V5 "BUMPWGT5"
16 #define CK_BUMP_META_FOOTER_MAGIC "BUMPV5MD"
17 
18 #pragma pack(push, 1)
19 typedef struct {
20  char magic[8]; /* "BUMPWGT5" */
21  uint32_t version; /* 5 */
22  uint32_t model_type; /* legacy placeholder (1) */
23  uint32_t num_layers;
24  uint32_t vocab_size;
25  uint32_t embed_dim;
27  uint32_t context_length;
28  uint32_t num_heads;
29  uint32_t num_kv_heads;
30  uint32_t head_dim;
32  uint64_t aligned_head_dim;
34  uint64_t aligned_context;
35  /* Tokenizer metadata (v4.1+) */
36  uint32_t num_merges;
38  uint8_t checksum[32]; /* SHA-256 of dtype table + weights payload */
39  uint8_t reserved[8]; /* Pad to 128 bytes (reserved) */
41 #pragma pack(pop)
42 
43 #define CK_BUMP_HEADER_SIZE 128
44 #define CK_BUMP_EXT_META_SIZE 24
45 #define CK_BUMP_DATA_START (CK_BUMP_HEADER_SIZE + CK_BUMP_EXT_META_SIZE)
46 
47 #pragma pack(push, 1)
48 typedef struct {
49  char magic[8]; /* "BUMPV5MD" */
50  uint64_t meta_size; /* JSON blob size (bytes) */
51  uint8_t meta_sha256[32]; /* SHA-256 of metadata JSON blob */
53 #pragma pack(pop)
54 
55 #define CK_BUMP_META_FOOTER_SIZE ((uint64_t)(8 + 8 + 32))
56 
57 #endif /* CKERNEL_BUMP_V5_H */
uint32_t num_heads
uint32_t vocab_size
uint64_t aligned_embed_dim
uint32_t context_length
uint32_t embed_dim
uint64_t aligned_head_dim
uint32_t intermediate_size
uint64_t aligned_intermediate
uint32_t num_kv_heads
uint32_t num_layers
uint32_t num_merges
uint32_t total_vocab_bytes
uint32_t model_type
uint64_t aligned_context