From 6aaa8fc37a65e4a6b06a20a996842751835a808f Mon Sep 17 00:00:00 2001 From: AutoJanitor Date: Sun, 12 Jul 2026 15:13:32 -0500 Subject: [PATCH] =?UTF-8?q?Makefile:=20Linux=20PowerPC=20(ppc64le)=20build?= =?UTF-8?q?=20support=20=E2=80=94=20-mcpu,=20scalar=20fallback,=20x86=20pa?= =?UTF-8?q?th=20untouched=20(#97)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PowerPC GCC uses -mcpu instead of -march, so the Linux branch failed with unrecognized option -march=native on ppc64le. Detect ppc64le and ppc64 via uname -m and use -mcpu=$(ARCH) there. The x86-64 path is unchanged. Validated on an IBM POWER8 S824 (Ubuntu 20.04, gcc 9.4): make test-c passes, teacher forcing 32/32 positions and greedy 20/20 tokens against the transformers oracle, engine reports the scalar idot fallback. Signed-off-by: Scott Co-authored-by: Scott --- c/Makefile | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/c/Makefile b/c/Makefile index c23a8db..cd40965 100644 --- a/c/Makefile +++ b/c/Makefile @@ -33,6 +33,18 @@ CFLAGS = -D_FILE_OFFSET_BITS=64 -O3 -march=$(ARCH) -fopenmp -Wall -Wextra -Wno- LDFLAGS = -lm -fopenmp -static EXE = .exe else +UNAME_M := $(shell uname -m) +ifneq (,$(filter ppc64le ppc64,$(UNAME_M))) +# --- Linux PowerPC (POWER8/POWER9/POWER10) --- +# PowerPC GCC uses -mcpu, not -march. ARCH=native works on gcc >= 4.7. +# The AVX2/NEON kernels fall back to the portable scalar C path +# (validated token-exact vs the transformers oracle on a POWER8 S824). +CC = gcc +ARCH ?= native +CFLAGS = -O3 -mcpu=$(ARCH) -fopenmp -Wall -Wextra -Wno-unused-parameter -Wno-misleading-indentation -Wno-unused-function +LDFLAGS = -lm -fopenmp +EXE = +else # --- Linux x86-64 (percorso originale, invariato) --- CC = gcc # ARCH=native -> ottimizzato per QUESTA macchina (default, piu' veloce). @@ -43,6 +55,7 @@ CFLAGS = -O3 -march=$(ARCH) -fopenmp -Wall -Wextra -Wno-unused-parameter -Wno-m LDFLAGS = -lm -fopenmp EXE = endif +endif # CUDA=1 adds an opt-in backend for resident tensors. The default build remains # pure C and keeps the original zero-dependency runtime.