From c4a1c97a09da6d8d88c2ac834bf6234506fc41bc Mon Sep 17 00:00:00 2001 From: Onur Gündüz Date: Mon, 15 Jun 2026 08:40:11 +0200 Subject: chore: run clang-format --- embed_internal.h | 54 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 31 insertions(+), 23 deletions(-) (limited to 'embed_internal.h') diff --git a/embed_internal.h b/embed_internal.h index 60fc581..d2c1a30 100644 --- a/embed_internal.h +++ b/embed_internal.h @@ -29,42 +29,50 @@ typedef struct { const float *norm; /* [hidden] */ } embed_weights_t; -typedef void (*embed_attention_fn)( - float *out, const float *Q, const float *K, const float *V, - const int *offsets, int batch, int n_heads, int n_kv_heads, - int head_dim, float scale, float *scratch, size_t scratch_bytes); +typedef void (*embed_attention_fn)(float *out, + const float *Q, + const float *K, + const float *V, + const int *offsets, + int batch, + int n_heads, + int n_kv_heads, + int head_dim, + float scale, + float *scratch, + size_t scratch_bytes); struct embed_model { - embed_config_t config; + embed_config_t config; embed_weights_t weights; - void *safetensors; /* multi_safetensors_t*, keeps mmap alive */ - int layer_start; /* loaded transformer range, inclusive */ - int layer_end; /* loaded transformer range, exclusive */ + void *safetensors; /* multi_safetensors_t*, keeps mmap alive */ + int layer_start; /* loaded transformer range, inclusive */ + int layer_end; /* loaded transformer range, exclusive */ embed_attention_fn attention; }; struct embed_workspace { - const embed_model_t *model; /* immutable model this workspace belongs to */ - int buf_seq_cap; - float *x; /* [seq, hidden] */ - float *x_norm; /* [seq, hidden] */ - float *q; /* [seq, q_dim] */ - float *k; /* [seq, kv_dim] */ - float *v; /* [seq, kv_dim] */ - float *attn_out; /* [seq, q_dim] */ - float *proj_out; /* [seq, hidden] */ - float *ffn_gate; /* [seq, intermediate] */ - float *ffn_up; /* [seq, intermediate] */ - float *attn_scores; /* reusable BLAS attention score tiles */ + const embed_model_t *model; /* immutable model this workspace belongs to */ + int buf_seq_cap; + float *x; /* [seq, hidden] */ + float *x_norm; /* [seq, hidden] */ + float *q; /* [seq, q_dim] */ + float *k; /* [seq, kv_dim] */ + float *v; /* [seq, kv_dim] */ + float *attn_out; /* [seq, q_dim] */ + float *proj_out; /* [seq, hidden] */ + float *ffn_gate; /* [seq, intermediate] */ + float *ffn_up; /* [seq, intermediate] */ + float *attn_scores; /* reusable BLAS attention score tiles */ size_t attn_scores_bytes; - int *offsets; /* [batch + 1] packed sequence offsets */ - int offsets_cap; + int *offsets; /* [batch + 1] packed sequence offsets */ + int offsets_cap; /* RoPE cosine/sine cache [n_pos, head_dim], grown lazily. */ float *rope_cos; float *rope_sin; - int rope_cache_cap; + int rope_cache_cap; /* F32 view of one BF16 weight matrix for SGEMM dispatch, grown to the * largest projection. Workspace-owned so concurrent workspaces on one -- cgit v1.3.1