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

test(cuda): wire test_fp8_cuda into cuda-test and add independent footprint oracle

monotophic9480d88cf3d1
diff --git a/c/Makefile b/c/Makefile
index d646cc9c..39856bc8 100644
--- a/c/Makefile
+++ b/c/Makefile
@@ -839,7 +839,7 @@ rans: $(RANSLIB)
$(RANSLIB): tools/rans_ctypes.c rans.h
$(CC) $(CFLAGS) -fPIC -shared $< -o $@ $(LDFLAGS)
-cuda-test: backend_cuda.cu backend_cuda.h backend_gpu_compat.h tests/test_backend_cuda.cu tests/test_ragged_attention.cu tests/test_absorb_determinism.cu tests/test_mxfp4_cuda.cu tests/mxfp4_ref.c tests/test_fp8_warp_cuda.cu
+cuda-test: backend_cuda.cu backend_cuda.h backend_gpu_compat.h tests/test_backend_cuda.cu tests/test_ragged_attention.cu tests/test_absorb_determinism.cu tests/test_mxfp4_cuda.cu tests/mxfp4_ref.c tests/test_fp8_warp_cuda.cu tests/test_fp8_cuda.cu
@command -v "$(GPUCC)" >/dev/null 2>&1 || { echo "$(GPUCC_NAME) not found" >&2; exit 1; }
"$(GPUCC)" $(GPUFLAGS) backend_cuda.cu tests/test_backend_cuda.cu -o backend_cuda_test$(EXE) $(ANS_NVCC_LIBS)
./backend_cuda_test$(EXE)
@@ -864,6 +864,11 @@ cuda-test: backend_cuda.cu backend_cuda.h backend_gpu_compat.h tests/test_backen
# one is expected to fail.
"$(GPUCC)" $(GPUFLAGS) backend_cuda.cu tests/test_absorb_determinism.cu -o absorb_determinism_test$(EXE)
./absorb_determinism_test$(EXE)
+ # fmt=8 (fp8-e4m3) kernel oracle + public API (LUT gate, dense, expert
+ # group, byte accounting). Includes backend_cuda.cu itself, so only the
+ # test file is compiled. Also runs BEFORE the MXFP4 test (same reason).
+ "$(GPUCC)" $(GPUFLAGS) tests/test_fp8_cuda.cu -o fp8_cuda_test$(EXE) $(ANS_NVCC_LIBS)
+ ./fp8_cuda_test$(EXE)
# MXFP4 (fmt=7) against the CPU decoder in quant.h. The reference is built
# as C on purpose: quant.h uses _Thread_local, which nvcc's C++ front end
# rejects, and re-implementing it for the test would defeat the comparison.
diff --git a/c/tests/test_fp8_cuda.cu b/c/tests/test_fp8_cuda.cu
index 8547624f..6c98c51e 100644
--- a/c/tests/test_fp8_cuda.cu
+++ b/c/tests/test_fp8_cuda.cu
@@ -283,6 +283,16 @@ int main(void){
got,want,bt->weight_bytes,bt->scale_count);
return 1;
}
+ /* Independent oracle: fmt=8 footprint from quant.h's documented
+ * layout -- O*I raw e4m3 bytes + ceil(O/128)*ceil(I/128) f32 block
+ * scales (hs_n above) -- no struct fields, so the accessor cannot
+ * validate itself against the counts upload happened to store. */
+ size_t indep=(size_t)I*D+(size_t)hs_n*sizeof(float);
+ if(got!=indep||bt->scale_count!=(size_t)hs_n){
+ printf("FAIL bytes-check fmt8 independent: got %zu want %zu (%d*%d + %d*4), scale_count %zu (want %d)\n",
+ got,indep,I,D,hs_n,bt->scale_count,hs_n);
+ return 1;
+ }
coli_cuda_tensor_free(bt);
free(bw);free(bs);