Run frontier MoE models on hardware you already own — pure C, zero deps, experts streamed from disk. Tiny engine, immense model. 🐦
C
fix(tests): make test_gsgemv's FMA reference exact, guard SSE4.1 tests to x86_64
Jaapjan Tinbergen01fdb0dd210b
diff --git a/c/Makefile b/c/Makefileindex 124b2fe9..c1324352 100644--- a/c/Makefile+++ b/c/Makefile@@ -464,14 +464,23 @@ endifTEST_RULES := $(shell sed -n 's|^tests/\(test_[a-z0-9_]*\)\$$(EXE):.*|\1|p' $(firstword $(MAKEFILE_LIST)))# test_uring is Linux-only. V4 engine tests are appended below only on supported# x86-64 Linux/Windows and aarch64 Linux hosts; the V4 infrastructure tests have-# unconditional rules and therefore remain portable gates.+# unconditional rules and therefore remain portable gates. test_gsgemv_sse41/+# test_qgemv_sse41 force -msse4.1/-mno-avx2/-mno-fma, which only exist as gcc/+# clang flags on x86 -- unconditionally in TEST_BINS they take down `check` on+# arm64 (e.g. macOS): "unsupported option '-msse4.1' for target arm64-...".+# Appended back below only on x86-64 hosts, alongside the other conditional+# platform tests already handled the same way.TEST_EXCLUDE = test_uring test_deepseek_v4 test_v4_ownership test_v4_serve_framing \test_segment_adapters_registration test_segment_adapters_real \- test_edge_adapters_registration test_edge_adapters_real+ test_edge_adapters_registration test_edge_adapters_real \+ test_gsgemv_sse41 test_qgemv_sse41TEST_BINS = $(addprefix tests/,$(addsuffix $(EXE),$(filter-out $(TEST_EXCLUDE),$(TEST_RULES))))ifneq (,$(LINUX))TEST_BINS += tests/test_uring$(EXE)endif+ifneq (,$(X86_64))+TEST_BINS += tests/test_gsgemv_sse41$(EXE) tests/test_qgemv_sse41$(EXE)+endififeq ($(COLI_V4_SUPPORTED),1)TEST_BINS += tests/test_v4_hybrid_policy$(EXE) tests/test_k3_fill_budget$(EXE) tests/test_v4_bank_pair$(EXE)TEST_BINS += tests/test_deepseek_v4$(EXE) tests/test_v4_ownership$(EXE) \diff --git a/c/tests/test_gsgemv.c b/c/tests/test_gsgemv.cindex 28ee166e..f5c8ef7b 100644--- a/c/tests/test_gsgemv.c+++ b/c/tests/test_gsgemv.c@@ -86,7 +86,15 @@ static void reference_gs_gemv(float *y, const float *x, const int8_t *q, const f__m128 s = _mm_add_ps(_mm256_castps256_ps128(a0), _mm256_extractf128_ps(a0,1));s = _mm_add_ps(s, _mm_movehl_ps(s,s));s = _mm_add_ss(s, _mm_shuffle_ps(s,s,1));- acc += _mm_cvtss_f32(s) * sc[gi];+ /* fmaf, not `acc += x * sc[gi]`: gsgemv.h's real AVX2 tier+ * (gs_group_sum + fmaf) fuses this step explicitly, so an+ * implicit multiply-add here only matches it when the compiler+ * happens to auto-contract -- true at -O2/-O3 with the default+ * -ffp-contract=fast, false at -O1 or with contraction off+ * (confirmed: -O3 -ffp-contract=off reproduces the mismatch).+ * Matching the explicit fmaf makes the comparison exact+ * regardless of optimisation flags, instead of accidentally so. */+ acc = fmaf(_mm_cvtss_f32(s), sc[gi], acc);}y[o] = acc;}