← Back to C-Kernel-Engine Docs Doxygen Source Documentation
 
Loading...
Searching...
No Matches
ck_model_abi_v8.h
Go to the documentation of this file.
1#ifndef CK_MODEL_ABI_V8_H
2#define CK_MODEL_ABI_V8_H
3
4#include <stddef.h>
5#include <stdint.h>
6
7#ifdef __cplusplus
8extern "C" {
9#endif
10
11#define CK_MODEL_ABI_V8_VERSION UINT32_C(1)
12
14 CK_MODEL_CAP_INIT = UINT64_C(1) << 0,
16 CK_MODEL_CAP_TEXT_ENCODE = UINT64_C(1) << 2,
17 CK_MODEL_CAP_TOKEN_DECODE = UINT64_C(1) << 3,
18 CK_MODEL_CAP_CHAT_FORMAT = UINT64_C(1) << 4,
19 CK_MODEL_CAP_STOP_TOKENS = UINT64_C(1) << 5,
24 CK_MODEL_CAP_ENCODER_OUTPUT = UINT64_C(1) << 10,
25 CK_MODEL_CAP_ENCODER_MEMORY = UINT64_C(1) << 11,
26 CK_MODEL_CAP_NAMED_ACTIVATIONS = UINT64_C(1) << 12,
27 CK_MODEL_CAP_PROFILE = UINT64_C(1) << 13,
28 CK_MODEL_CAP_XRAY_KV = UINT64_C(1) << 14,
29 CK_MODEL_CAP_GENERATION_POLICY = UINT64_C(1) << 15,
30 /* Serialized state switching only; this does not imply batched arithmetic. */
32 /* Generated M=2 projection work with sequence-local attention/KV. */
33 CK_MODEL_CAP_BATCH_DECODE_TWO_ROWS = UINT64_C(1) << 17
34};
35
36#define CK_MODEL_CAP_V8_KNOWN_MASK ((UINT64_C(1) << 18) - UINT64_C(1))
37
41
48
49/* Fixed-layout descriptor. New fields consume reserved slots and require an
50 * ABI version bump when their interpretation changes. Hosts must check both
51 * struct_size and abi_version before using it. */
66
67typedef uint32_t (*ck_model_get_abi_version_v8_fn)(void);
68typedef uint64_t (*ck_model_get_capabilities_v8_fn)(void);
71 size_t descriptor_size);
72
73/* Optional when CK_MODEL_CAP_SEQUENCE_STATE_SWITCH is set. All calls, including
74 * decode and reset, remain serialized. Nonzero handles are generation-tagged
75 * IDs; retired handles and handles from an earlier model load are rejected.
76 * The default state uses the model arena. Each extra sequence needs a caller-
77 * owned aligned KV arena of the reported size; it must remain alive through
78 * destroy or model_free. Admission is bounded to two extra sequences. This
79 * ABI provides isolation, not simultaneous or computationally batched decode.
80 */
81typedef int (*ck_model_sequence_state_requirements_v8_fn)(size_t *bytes, size_t *alignment);
82typedef uint64_t (*ck_model_sequence_state_default_v8_fn)(void);
83typedef int (*ck_model_sequence_state_create_v8_fn)(void *arena, size_t arena_bytes,
84 uint64_t *handle_out);
85typedef int (*ck_model_sequence_state_activate_v8_fn)(uint64_t handle);
86typedef int (*ck_model_sequence_state_destroy_v8_fn)(uint64_t handle);
87
88/* Optional when CK_MODEL_CAP_BATCH_DECODE_TWO_ROWS is set. The first version
89 * accepts two distinct sequence handles with one token each. row_offset and
90 * token_count reserve explicit packed-row geometry for future mixed steps;
91 * unsupported values fail before either sequence advances. Caller owns
92 * distinct output vectors and one 64-byte-aligned workspace for the call.
93 * Calls remain serialized with all other model operations. */
96 int32_t token;
97 int32_t position;
98 uint32_t row_offset;
99 uint32_t token_count;
100 float *logits;
102
103typedef int (*ck_model_batch_decode_workspace_v8_fn)(size_t *bytes, size_t *alignment);
104/* Optional diagnostics on generated batch entries; absent on older bundles. */
108 size_t count, void *workspace,
109 size_t workspace_bytes);
110
111#ifdef __cplusplus
112}
113#endif
114
115#endif
int(* ck_model_get_runtime_descriptor_v8_fn)(CKModelRuntimeDescriptorV8 *descriptor, size_t descriptor_size)
int(* ck_model_batch_decode_projection_groups_v8_fn)(void)
uint64_t(* ck_model_get_capabilities_v8_fn)(void)
CKModelArtifactRoleV8
@ CK_MODEL_ROLE_DECODER
@ CK_MODEL_ROLE_ENCODER
@ CK_MODEL_ROLE_UNKNOWN
@ CK_MODEL_ROLE_COMBINED
int(* ck_model_decode_batch2_v8_fn)(const CKModelBatchDecodeRowV8 *rows, size_t count, void *workspace, size_t workspace_bytes)
int(* ck_model_batch_decode_shared_layers_v8_fn)(void)
uint32_t(* ck_model_get_abi_version_v8_fn)(void)
CKModelCapabilityV8
@ CK_MODEL_CAP_ENCODER_MEMORY
@ CK_MODEL_CAP_ENCODER_OUTPUT
@ CK_MODEL_CAP_STOP_TOKENS
@ CK_MODEL_CAP_INIT
@ CK_MODEL_CAP_SEQUENCE_STATE_SWITCH
@ CK_MODEL_CAP_AUTOREGRESSIVE_DECODE
@ CK_MODEL_CAP_CHAT_FORMAT
@ CK_MODEL_CAP_AUDIO_WAV_ENCODER
@ CK_MODEL_CAP_GENERATION_POLICY
@ CK_MODEL_CAP_TOKEN_DECODE
@ CK_MODEL_CAP_XRAY_KV
@ CK_MODEL_CAP_IMAGE_TENSOR_ENCODER
@ CK_MODEL_CAP_PROFILE
@ CK_MODEL_CAP_NAMED_ACTIVATIONS
@ CK_MODEL_CAP_TEXT_ENCODE
@ CK_MODEL_CAP_MIXED_EMBEDDING_PREFILL
@ CK_MODEL_CAP_RAW_IMAGE_ENCODER
@ CK_MODEL_CAP_BATCH_DECODE_TWO_ROWS
int(* ck_model_sequence_state_destroy_v8_fn)(uint64_t handle)
int(* ck_model_batch_decode_workspace_v8_fn)(size_t *bytes, size_t *alignment)
CKGenerationFlagsV8
@ CK_GENERATION_FLAG_TIMESTAMPS
uint64_t(* ck_model_sequence_state_default_v8_fn)(void)
int(* ck_model_sequence_state_activate_v8_fn)(uint64_t handle)
int(* ck_model_sequence_state_create_v8_fn)(void *arena, size_t arena_bytes, uint64_t *handle_out)
int(* ck_model_sequence_state_requirements_v8_fn)(size_t *bytes, size_t *alignment)
const uint8_t size_t count
Definition true_bpe.h:209