iOS integration layer for EMLX (MLX backend for Nx).
This module provides automatic iOS-specific configuration for using EMLX on iOS devices and simulator. No manual configuration needed.
iOS Constraints
- Real iOS devices: JIT is automatically disabled (W^X policy)
- iOS Simulator: JIT works and is auto-enabled for development
- Metal GPU: Automatically used on Apple Silicon (unified memory)
Usage (Zero config!)
# That's it! Just use Nx/EMLX as normal.
# The backend is automatically configured when your app starts.
tensor = Nx.tensor([1.0, 2.0, 3.0])
Nx.sum(tensor) # Uses EMLX backend on iOS, Nx.BinaryBackend elsewhere
Summary
Functions
Checks if EMLX is available and properly configured.
Runs a simple benchmark to verify GPU acceleration.
Returns the default device for the current platform.
Returns true if running on a real iOS device (not simulator).
Returns true if running in iOS Simulator.
Returns the appropriate EMLX configuration for the current iOS platform.
Auto-configures EMLX for the current platform.
Creates a simple test tensor to verify EMLX is working.
Functions
Checks if EMLX is available and properly configured.
Runs a simple benchmark to verify GPU acceleration.
Returns the default device for the current platform.
Returns true if running on a real iOS device (not simulator).
Returns true if running in iOS Simulator.
Returns the appropriate EMLX configuration for the current iOS platform.
Automatically detects device vs simulator and configures appropriately.
Auto-configures EMLX for the current platform.
Call this once at app startup. It will:
- Detect if running on iOS device or simulator
- Disable JIT on real devices (required by W^X policy)
- Enable Metal GPU acceleration on Apple Silicon
- Set EMLX as the default Nx backend
Safe to call multiple times. On non-iOS platforms, this is a no-op.
Creates a simple test tensor to verify EMLX is working.