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(build): handle portable detection edge cases

RonitBStudent53324fdcf0f5
diff --git a/c/Makefile b/c/Makefile
index 66a290bd..1ed6df6b 100644
--- a/c/Makefile
+++ b/c/Makefile
@@ -14,7 +14,6 @@ TRIPLET := $(shell $(DETECT_CC) -dumpmachine 2>/dev/null)
MINGW := $(findstring mingw,$(TRIPLET))
CYGWIN := $(findstring cygwin,$(TRIPLET))
DARWIN := $(findstring darwin,$(TRIPLET))
-PPC64 := $(findstring powerpc64,$(TRIPLET))
LINUX := $(findstring linux,$(TRIPLET))
IS_WIN := $(MINGW)$(CYGWIN)
@@ -27,7 +26,6 @@ ifeq ($(IS_WIN),)
UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)
DARWIN := $(findstring Darwin,$(UNAME_S))
-PPC64 := $(findstring ppc64,$(UNAME_M))
endif
endif
@@ -37,6 +35,7 @@ TARGET_CPU := $(UNAME_M)
endif
X86_64 := $(filter x86_64 amd64,$(TARGET_CPU))
AARCH64 := $(filter aarch64 arm64,$(TARGET_CPU))
+PPC64 := $(filter powerpc64% ppc64%,$(TARGET_CPU))
ifneq (,$(DARWIN))
# --- macOS / Apple Silicon ---
@@ -47,7 +46,7 @@ CC = clang
OMPDIR := $(shell brew --prefix libomp 2>/dev/null)
# `brew --prefix libomp` can print the formula's prospective path even when it
# is not installed, so verify both artifacts before adding unusable flags.
-ifneq ($(and $(wildcard $(OMPDIR)/include/omp.h),$(wildcard $(OMPDIR)/lib/libomp.*)),)
+ifneq ($(and $(OMPDIR),$(wildcard $(OMPDIR)/include/omp.h),$(wildcard $(OMPDIR)/lib/libomp.*)),)
OMPC = -Xclang -fopenmp -I$(OMPDIR)/include
OMPL = -L$(OMPDIR)/lib -lomp
else
diff --git a/c/tests/test_makefile_platform.py b/c/tests/test_makefile_platform.py
index 4ca4efcf..3c728802 100644
--- a/c/tests/test_makefile_platform.py
+++ b/c/tests/test_makefile_platform.py
@@ -52,6 +52,7 @@ class MakefilePlatformTests(unittest.TestCase):
("x86_64-unknown-linux-gnu", "-march=x86-64-v3"),
("aarch64-unknown-linux-gnu", "-march=armv8-a"),
("powerpc64le-unknown-linux-gnu", "-mcpu=power8"),
+ ("ppc64le-unknown-linux-gnu", "-mcpu=power8"),
)
for triplet, expected_flag in cases: