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

kimi_k3: keep K3_CUDA the only engine switch; coli maps --gpu onto it

JustVugg2bc08d0ea452
diff --git a/c/kimi_k3.c b/c/kimi_k3.c
index 549d1eb8..a05f6336 100644
--- a/c/kimi_k3.c
+++ b/c/kimi_k3.c
@@ -533,13 +533,6 @@ static int g_k3_mmap=0; /* prepared U8/F32 tensors stay file-ba
static uint64_t g_k3_mmap_bytes=0, g_k3_mmap_views=0;
#ifdef COLI_CUDA
static int g_k3_cuda=0; /* K3_CUDA=1: MXFP4 routed experts on CUDA at decode */
-/* K3_CUDA is the explicit override. COLI_CUDA is what `coli --gpu` writes. */
-static int k3_cuda_requested(void){
- const char *e=getenv("K3_CUDA");
- if(e && *e) return atoi(e);
- e=getenv("COLI_CUDA");
- return e ? atoi(e) : 0;
-}
#endif
static int g_k3_direct=-1; /* K3_DIRECT: O_DIRECT expert reads */
static int g_k3_idot=1; /* K3_IDOT: int8-activation expert matmuls */
@@ -847,7 +840,7 @@ static void model_init_range(Model *m, const char *snap, int layer_begin,
{ const char *ev=getenv("K3_VK"); vk_requested=!ev||atoi(ev); }
#endif
#ifdef COLI_CUDA
- cuda_requested=k3_cuda_requested();
+ cuda_requested=getenv("K3_CUDA")&&atoi(getenv("K3_CUDA"));
#endif
if(!k3_mmap_backend_allowed(1,vk_requested,cuda_requested)){
fprintf(stderr,"K3_MMAP=1 is CPU-only; set K3_VK=0 and K3_CUDA=0 -- refusing before model load\n");
@@ -856,7 +849,7 @@ static void model_init_range(Model *m, const char *snap, int layer_begin,
fprintf(stderr,"[K3-MMAP] prepared tensor mapping enabled (CPU-only, no conversion fallback)\n");
}
#ifdef COLI_CUDA
- g_k3_cuda = k3_cuda_requested();
+ g_k3_cuda = getenv("K3_CUDA") ? atoi(getenv("K3_CUDA")) : 0;
if(g_k3_cuda){
int dev0 = 0;
if(!coli_cuda_init(&dev0, 1)){