mirror of
https://github.com/hanzoai/ANE.git
synced 2026-10-30 18:53:51 +00:00
- ane_universal.h: Auto-detecting runtime that selects InMem (M4+) or CoreML fallback (M1-M3) based on hardware capability probing - ane_probe_m1.m: Deep diagnostic found all 74 ANE classes present on M1 but _ANECompiler binary rejects all MIL programs (40+ format combos) - ane_m1_fix.m: Systematic MIL format fuzzer (program versions 1.0-1.3, opsets ios15-ios18, weight offsets, old/new syntax) — all fail on M1 - ane_coreml_bridge.m: CoreML ANE bridge showing 2.44x speedup at 256x256 - benchmark_apple_silicon.py: MLX vs MPS vs CoreML comparison on M1 Max - MLX: 6.72 TFLOPS peak (fp16), 62ms/step training - MPS: 4.12 TFLOPS peak, 84ms/step training - ANE via CoreML: ~1x (dispatch overhead negates hardware advantage) - demo_mlx_training.py: Working 4-layer transformer training, 4688 tok/s - Updated README with M1-M4 compatibility matrix and integration points - Added .gitignore for compiled binaries and .venv
63 lines
1.7 KiB
Makefile
63 lines
1.7 KiB
Makefile
CC = xcrun clang
|
|
CFLAGS = -O2 -Wall -Wno-deprecated-declarations -fobjc-arc
|
|
FRAMEWORKS = -framework Foundation -framework CoreML -framework IOSurface -framework Accelerate
|
|
LDFLAGS = $(FRAMEWORKS) -ldl
|
|
|
|
# Universal binaries (work on M1→M4+)
|
|
BINS = ane_universal_test ane_probe_m1 ane_coreml_bridge ane_m1_fix
|
|
|
|
# Python venv for coremltools
|
|
VENV = .venv/bin/python
|
|
|
|
.PHONY: all clean bench train demo setup test help
|
|
|
|
help:
|
|
@echo "ANE — Apple Neural Engine Benchmarks & Training"
|
|
@echo ""
|
|
@echo " make setup Install Python deps (coremltools, mlx, torch)"
|
|
@echo " make all Build all binaries"
|
|
@echo " make test Run universal ANE test (auto-detects M1/M4)"
|
|
@echo " make bench Run comprehensive MLX vs MPS vs ANE benchmarks"
|
|
@echo " make demo Run MLX training demo"
|
|
@echo " make train Build training binaries (M4+ only)"
|
|
@echo " make clean Remove built binaries"
|
|
|
|
all: $(BINS)
|
|
|
|
setup:
|
|
uv venv .venv
|
|
source .venv/bin/activate && uv pip install coremltools numpy mlx mlx-lm torch
|
|
@echo "Setup complete. Run: make test"
|
|
|
|
# Universal test (M1→M4+)
|
|
ane_universal_test: ane_universal_test.m ane_universal.h
|
|
$(CC) $(CFLAGS) -o $@ ane_universal_test.m $(LDFLAGS)
|
|
|
|
# Diagnostic probes
|
|
ane_probe_m1: ane_probe_m1.m
|
|
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
|
|
ane_coreml_bridge: ane_coreml_bridge.m
|
|
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
|
|
ane_m1_fix: ane_m1_fix.m
|
|
$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS)
|
|
|
|
# Run tests
|
|
test: ane_universal_test
|
|
./ane_universal_test
|
|
|
|
bench: setup
|
|
$(VENV) benchmark_apple_silicon.py
|
|
|
|
demo: setup
|
|
$(VENV) demo_mlx_training.py
|
|
|
|
# M4+ training (will fail on M1-M3)
|
|
train:
|
|
$(MAKE) -C training train_large
|
|
|
|
clean:
|
|
rm -f $(BINS)
|
|
$(MAKE) -C training clean
|