Rust ML on iOS Modernization

A proposed approach to resolve memory pressure, improve architecture, and accelerate the development cycle.

Core Concerns

  • Memory Pressure: Frequent crashes on iOS, especially when using the Metal GPU backend.
  • Unwieldy Architecture: Difficult and slow to update dependencies like `mistralrs` or add new models.
  • Bug Isolation: Hard to diagnose if issues originate in Candle, Godot, or our own integration code.
  • Slow Dev Cycle: The build-test-debug loop for iOS is too complex and time-consuming.

Key Benefits of this Plan

  • Faster Iteration: Dedicated, lightweight test harnesses for rapid validation on desktop and iOS.
  • Isolate Issues: A staged pipeline to separate core logic bugs from Godot-specific integration problems.
  • Scalable Architecture: Decoupled crates make adding new models a simple, low-risk process.
  • Modern Tooling: Relies on actively maintained tools like Tauri's `cargo-mobile` and `PyO3`.

Proposed Architecture

atelico-models
atelico-runtime (Core Engine)
atelico-python
atelico-godot
atelico-ios

Staged Validation Pipeline

1

Desktop Validation

Fastest loop using the Python wrapper. Verify core logic, test new models, and catch panics before they hit a device.

2

Minimal iOS Harness

Use `cargo mobile run` to deploy a zero-UI app. Confirms compilation, linking, and basic functionality on-device (CPU & Metal).

3

Empty Godot Harness

Deploy only the GDExtension to an empty Godot project. Profile and isolate memory/performance issues within the Godot runtime.

4

Full Game Integration

Once all previous stages pass, integrate the stable GDExtension into the full production game for final validation.