You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Phase C: MLX backend port for AMICATorchNG (Apple-native GPU) #76
Higher-ceiling Apple-GPU path of the epic. MLX (Apple's array framework) beats PyTorch
MPS by ~2-3x on the same hardware, is Apple-native with a real compiler / lazy graph, and
can fuse the per-block work that PyTorch MPS runs eager and largely unfused. GPU arrays are
float32-only, so this depends on Phase A.
Approach
Port the AMICATorchNG per-block E/M-step to MLX arrays behind a backend switch, keeping
the PyTorch path as the float64 parity / CUDA backend.
Reuse the Phase A mixed-precision strategy (float64 accumulation on CPU where MLX allows,
float32 on GPU).
Keep MLX an optional dependency (not required for the core install).
Acceptance
MLX backend produces results equivalent to the PyTorch float32 backend on the sample data
(matched LL within tolerance).
Behavior-validated (no bit-exact float64 oracle is possible on an Apple GPU).
Optional-dependency install path documented.
Dependencies
Blocked by Phase A (MLX GPU is float32-only). Research: .context/mps_pathways.md
Pathway C.
Done via PR #79 (squash-merged into the epic branch feature/issue-74-epic-apple-gpu, commit 4ff3a11). AMICAMLXNG (pyAMICA/mlx_impl/core.py) is a v1 MVP: single-model, generalized-Gaussian, natural gradient. Hybrid design forced by MLX 0.32 (GPU float32 hot path + CPU-stream inv/slogdet hoisted to once/iter + host-side SciPy for the missing lgamma/digamma), carrying the Phase A ufp/y guard. Validated on real EEG: sufficient stats match the NumPy float64 reference to rtol ~1e-4, converged LL matches the PyTorch float32 backend to ~2e-6. Optional dependency (Apple-only), so CI skips the MLX tests (and mlx_impl is omitted from the coverage gate). Newton, the other PDF families, sharing, multi-model, and save/load are fast-follows. Whether MLX beats CPU/MPS is Phase B's question. Phase C of epic #74.
Activity
Phase C: MLX backend AMICAMLXNG (v1 MVP) (#79)
neuromechanist commentedon Jul 8, 2026
Done via PR #79 (squash-merged into the epic branch
feature/issue-74-epic-apple-gpu, commit 4ff3a11).AMICAMLXNG(pyAMICA/mlx_impl/core.py) is a v1 MVP: single-model, generalized-Gaussian, natural gradient. Hybrid design forced by MLX 0.32 (GPU float32 hot path + CPU-stream inv/slogdet hoisted to once/iter + host-side SciPy for the missing lgamma/digamma), carrying the Phase A ufp/y guard. Validated on real EEG: sufficient stats match the NumPy float64 reference to rtol ~1e-4, converged LL matches the PyTorch float32 backend to ~2e-6. Optional dependency (Apple-only), so CI skips the MLX tests (and mlx_impl is omitted from the coverage gate). Newton, the other PDF families, sharing, multi-model, and save/load are fast-follows. Whether MLX beats CPU/MPS is Phase B's question. Phase C of epic #74.Address PR #82 review findings
Phase D: Multi-model support for AMICAMLXNG (#82)