Skip to content

Add Android and iOS MNN diffusion with shared catalog recovery - #768

Open
ShiftHackZ wants to merge 5 commits into
developfrom
feature/mnn
Open

ShiftHackZ wants to merge 5 commits into
developfrom
feature/mnn

Conversation

@ShiftHackZ

@ShiftHackZ ShiftHackZ commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Description

Refs #517. Related: #679.

  • Add an Alpha MNN 3.6.2 SD 1.5 provider: Android arm64 CPU/OpenCL and iOS 17+ CPU/Metal, behind the same KMP contract. Keep native implementations and unsupported-platform behavior behind platform DI.
  • Integrate Android isolated inference and iOS Swift runtime ownership, cancellation, finite background execution, strict model archives, immutable model leases and gallery results. Follow the existing module layout with a dedicated Swift package.
  • Share catalog loading/error/retry UI across all six local providers, use Apple icons for local providers on iOS and Android icons on Android, preserve model selections and transfers, and exclude custom models from storage usage. Keep original user-managed model files untouched.
  • Publish the 1.15 GB SD 1.5 General bundle with tokenizer, manifest, checksum, license and attribution on Hugging Face, pinned to an immutable revision in docs/mnn.json.
  • Correct shared CLIP word-boundary/EOS padding and PNDM predictor/corrector timesteps. Display iOS overall progress as a percentage while preserving the requested sampling steps.
  • Bound Metal attention scratch memory, release completed temporary weight uploads during low-memory model construction, propagate failed GPU work, and explicitly disable initial Metal tuning to prevent prolonged first-forward profiling.
  • Add regression coverage for storage, validation, model ownership, interruption, presentation, tokenization, sampling and native Metal operators. Separate CI into MNN Linux/Apple checks, OpenAI contracts, Easy Diffusion contracts and the complete Kotlin/lint/coverage suite, with one aggregate Codecov upload.
  • Add provider documentation and synchronized translations. Normalize native build paths; earlier native reproducibility checks produced byte-identical libraries from different directories and verified arm64-only FOSS APK contents.

Screenshots / Video (Optional)

Checklist

  • I have ensured this PR does not contain any breaking changes for existing functionality
  • I have added automated tests that cover the new behavior and removed obsolete tests and code
  • I have added documentation for any new public APIs and update existing documentation for any changes to public APIs

Tested On

  • Android: Emulator
  • Android: Real device
  • iOS: Simulator
  • iOS: Real iPhone device

Local build/check evidence includes Android FullDev/FOSS assembly, iOS device/simulator Kotlin and Xcode integration builds, Kotlin/JVM, Swift and Kotlin/Native suites, native graph/operator checks, packaging contracts, lint and formatting. Simulator builds and component checks do not establish simulator generation support or application runtime acceptance.

Physical iPhone: CPU produced recognizable cat outputs with random and fixed seeds; percentage display was confirmed. Metal completed cat, 20 sampling steps, seed 721925621, including VAE decoding and PNG output, in approximately 26.9 seconds after the memory-lifetime and tuning fixes. This verifies that scenario, not universal image quality or exclusive GPU placement. Android import, CPU output and cancellation were exercised earlier; the latest shared tokenizer/sampler changes still need Android application repetition.

MNN remains Alpha. Broader cancellation/background/expiry, successful output after cache clearing, model removal/replacement races, application catalog downloads, representative Android GPU/Mali and other-provider regressions remain open. Native reproducibility evidence predates the final runtime repairs and does not establish two complete independent F-Droid APK rebuilds.

The immutable archive's anonymous availability, size, checksum and accompanying small files were verified. Application download acceptance and Pages catalog integration remain pending.

@ShiftHackZ ShiftHackZ linked an issue Nov 17, 2026 that may be closed by this pull request
@ShiftHackZ ShiftHackZ changed the title Add Alpha MNN diffusion provider and shared catalog recovery Add MNN diffusion provider and shared catalog recovery Nov 17, 2026
@ShiftHackZ ShiftHackZ changed the title Add MNN diffusion provider and shared catalog recovery Add Android and iOS MNN diffusion with shared catalog recovery Nov 17, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mnn format

1 participant