Run frontier MoE models on hardware you already own β pure C, zero deps, experts streamed from disk. Tiny engine, immense model. π¦
C
fix(v4/cuda): the runtime arch gate still refused pre-Ampere cards
8PotatoChip87e359b591c0b
diff --git a/c/backend_cuda_dsv4.cu b/c/backend_cuda_dsv4.cuindex d04971b5..6ae6d96d 100644--- a/c/backend_cuda_dsv4.cu+++ b/c/backend_cuda_dsv4.cu@@ -671,17 +671,35 @@ static float *g_kv_comp[DSV4_KV_CACHE_LAYERS];static int g_kv_comp_cap[DSV4_KV_CACHE_LAYERS];/* Which GPUs this build's kernels can run on. The DeepGEMM build carries- * sm_120a-only block-scaled MMA kernels; the generic build is a portable fat- * binary of plain CUDA kernels (fp32 compute from fp8/fp4 decode) that runs- * on any sm_80+ card. The engine's loader tries the DeepGEMM DLL first and- * falls back to the generic one when this says no. */+ * sm_120a-only block-scaled MMA kernels. The generic build is a portable fat+ * binary of plain CUDA kernels (fp32 compute from fp8/fp4 decode); the engine's+ * loader tries the DeepGEMM DLL first and falls back to the generic one when+ * this says no.+ *+ * The generic floor is sm_60, not sm_80. Nothing in these kernels needs Ampere:+ * bf16 is storage only (every use is a __bfloat162float / __float2bfloat16+ * convert, the arithmetic is fp32) and fp8 weights are decoded through a+ * constant lookup table rather than fp8 tensor cores. The warp primitives used+ * here (__shfl_*_sync, __syncwarp) are sm_30-era and impose no floor of their+ * own.+ *+ * sm_60 is chosen because Pascal is the oldest architecture this has actually+ * been validated on -- sm_61 on a GTX 1080 Ti, matching the CPU reference to+ * 2^-26. Maxwell would very likely work and is deliberately NOT claimed here,+ * because nobody has run it.+ *+ * This is a RUNTIME gate and is separate from what the build actually contains:+ * a binary compiled with CUDA_ARCH=portable still has no sm_61 or sm_75 code in+ * it. Use CUDA_ARCH=portable-pre-ampere for those cards. Saying yes here for a+ * card the build has no cubin for surfaces as a "no kernel image is available"+ * launch failure, not a wrong answer. */extern "C" int dsv4_cuda_backend_arch_ok(int device){cudaDeviceProp prop;if(cudaGetDeviceProperties(&prop,device)!=cudaSuccess){cudaGetLastError();return 0;}#ifdef COLI_DSV4_DEEPGEMMreturn prop.major==12;#else- return prop.major>=8;+ return prop.major>=6;#endif}extern "C" const char *dsv4_cuda_backend_name(void){diff --git a/docs/deepseek-v4.md b/docs/deepseek-v4.mdindex 69f2c856..f870988c 100644--- a/docs/deepseek-v4.md+++ b/docs/deepseek-v4.md@@ -266,6 +266,12 @@ is no software path to fall back to.| CPU only (no DLL / `DSV4_CUDA=0` / Linux default) | β | CPU reference | CPU reference || generic DLL / `CUDA=1` | any sm_80+ | GPU attention block, indexer, generic batched MoE on the VRAM bank | GPU attention, indexer, expert mirrors || generic, pre-Ampere / `CUDA=1 CUDA_ARCH=portable-pre-ampere NO_TC=1` | sm_61 (Pascal), sm_75 (Turing) | as generic | as generic |++The runtime check `dsv4_cuda_backend_arch_ok` admits sm_60 and up for the+generic build. It is deliberately independent of what the binary contains: a+`CUDA_ARCH=portable` build has no sm_61/sm_75 cubin, and running it on such a+card fails at launch with "no kernel image is available" rather than producing+a wrong answer. Build with `portable-pre-ampere` for those cards.| DeepGEMM DLL / `CUDA=1 DEEPGEMM=1` | compute 12.x | as generic + tensor-core dense/MoE GEMMs | same as generic || multi-GPU | β | single device today (`DSV4_CUDA_DEVICE` selects); expert-parallel design drafted, not implemented | β |