Skip to content

Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦

C

fix(v4): align base scratch_ptr to 32-byte boundary before sub-allocations

Thanniru Sai Teja8e3e2e107977
diff --git a/c/deepseek_v4.c b/c/deepseek_v4.c
index 85c8866a..33eaa894 100644
--- a/c/deepseek_v4.c
+++ b/c/deepseek_v4.c
@@ -3838,6 +3838,8 @@ int coli_v4_indexer_select_batch(ColiDeepSeekV4Indexer *state, int *indices,
if (!scratch_ptr || !raw_weights)
return set_error(error, error_size, "out of memory scoring indexer batch");
+ scratch_ptr = (char *)(((uintptr_t)scratch_ptr + 31) & ~(uintptr_t)31);
+
float *queries = (float *)scratch_ptr; scratch_ptr += sz_queries;
float *sq = (float *)scratch_ptr; scratch_ptr += sz_sq;
float *head_weights = (float *)scratch_ptr; scratch_ptr += sz_head_weights;