Skip to content

Releases

Kggml v0.2.0

Choose a tag to compare

@github-actions github-actions released this 05 Dec 20:02
4bad225

Second pre-1.0 release of Kggml (com.donfuldauer), a modular on-device AI SDK for Kotlin Multiplatform wrapping ggml (whisper.cpp, llama.cpp + libmtmd, and stable-diffusion.cpp) across Android, iOS, macOS, and JVM Desktop.

0.2.0 is about running on real devices reliably: GPU problems now fall back to the CPU at load time instead of aborting, every engine tells you why it is not on the GPU, Android and iOS pick the fastest CPU code for the device at run time, first loads on iPhone no longer compile Metal shaders, and Windows x64 desktop gets Vulkan. It also adds a Swift package for the xcframeworks, a published API reference, and API/ABI compatibility checks ahead of 1.0.0.

Status: pre-1.0. Public APIs may still change between 0.x minor releases; this release contains a few small source breaks (see Upgrading from 0.1.0). Stability criteria for 1.0.0 are tracked in #104.

Maven Central (com.donfuldauer:kggml-bom:0.2.0)

dependencies {
    implementation(platform("com.donfuldauer:kggml-bom:0.2.0"))

    implementation("com.donfuldauer:kggml-whisper")        // speech-to-text (whisper.cpp)
    implementation("com.donfuldauer:kggml-llama")          // text generation, embeddings, vision (llama.cpp + libmtmd)
    implementation("com.donfuldauer:kggml-diffusion")      // text-to-image (stable-diffusion.cpp)
    implementation("com.donfuldauer:kggml-model-manager")  // optional: resumable SHA-256 downloads, RAM estimator, cache
    implementation("com.donfuldauer:kggml-runtime-vulkan") // optional: GPU via Vulkan (Android API 28+, desktop Linux & Windows x86_64)
    implementation("com.donfuldauer:kggml-runtime-opencl") // optional: Android GPU via OpenCL (Adreno, API 28+)
}

Minimum consumer Kotlin version (Kggml is built with Kotlin 2.5.0): 2.4.0 for Android / JVM, 2.5.0 for iOS / macOS (Kotlin/Native reads only klibs whose ABI version is not newer than its own). Details in the README's "Minimum Kotlin version" section (#246).

Published coordinates

Coordinate Targets / Native artifacts
com.donfuldauer:kggml-bom BOM (pom) aligning all 8 library coordinates below
com.donfuldauer:kggml-core-api Pure Kotlin: Android, JVM, iosArm64, iosSimulatorArm64, macosArm64
com.donfuldauer:kggml-runtime Shared ggml runtime (CPU everywhere, Metal on Apple). Android AAR (arm64-v8a with runtime-selected CPU variants, x86_64), JVM jar (linux-x86_64, linux-aarch64, windows-x86_64, windows-aarch64, macos-aarch64), iOS & macosArm64
com.donfuldauer:kggml-runtime-vulkan Optional Vulkan GPU add-on: Android AAR (arm64-v8a, x86_64), JVM jar (linux-x86_64, new: windows-x86_64); no-op on other platforms
com.donfuldauer:kggml-runtime-opencl Optional OpenCL GPU add-on: Android AAR (arm64-v8a, x86_64); no-op on other platforms
com.donfuldauer:kggml-whisper WhisperEngine (one-shot + live streaming with native resampler & VAD, iOS Core ML encoder & CPU-only background safety)
com.donfuldauer:kggml-llama LlamaEngine (streaming generation, GBNF / JSON Schema grammars, KV-cache sessions, embeddings, in-memory VLM via libmtmd)
com.donfuldauer:kggml-diffusion DiffusionEngine (SD 1.x / 2.x / XL / Flux / SD 3.5 image generation with step progress and cancellation)
com.donfuldauer:kggml-model-manager Pure Kotlin: resumable HTTP Range downloads, SHA-256 verification, GGUF/Whisper header RAM estimator, memory-pressure cache eviction

Highlights

New APIs

  • Why an engine is not on the GPU (#244): every InferenceEngine now reports backendFallbackReason (null when it runs on the backend you asked for, otherwise e.g. PowerVR excluded (set KGGML_VULKAN_ALLOW_POWERVR=1 to allow): ...) and activeDeviceName (e.g. Adreno (TM) 730). KggmlRuntime.unavailableReason(backend) and KggmlRuntime.deviceNames(backend) expose the same per backend, and each fallback is logged once as a kggml line.
  • closeAndAwait() (#240): a suspending close that returns only once the engine's native memory has been released. close() still schedules the release on the engine thread and returns immediately.
  • Per-engine flash-attention default (#158): BackendConfig.useFlashAttention is now Boolean?; null (the default) uses each engine's default — on for Whisper (about 2× faster on mobile CPUs, identical text), auto for Llama, off for Diffusion.
  • Native logs on logcat (#220): on Android, ggml / engine logs and native stderr are forwarded to logcat.

GPU robustness: fall back instead of aborting

  • Load-time GPU warm-up (#219, #223): Llama, Diffusion and Whisper GPU contexts prove at load that the backend can build its compute pipelines; a driver that cannot (e.g. Vulkan createComputePipeline: ErrorUnknown on Adreno 730) makes the engine fall back to the CPU at load instead of failing mid-inference.
  • Allocation failures are errors, not crashes (#274, #276): a weight / GPU buffer that cannot be allocated now fails the model load with a typed InferenceException in Whisper, Llama (incl. the libmtmd projector) and Diffusion instead of a GGML_ASSERT abort.
  • Diffusion on Metal (#239): nil Metal buffers fail cleanly, and the Metal memory budget is checked at load.
  • Diffusion on OpenCL (#238): OpenCL is kept out of AUTO on Android, and an op the OpenCL backend cannot run fails the call instead of aborting.
  • iOS simulator (#242): Metal is reported unavailable in the simulator (its device reports a zero working set, which crashed Whisper and corrupted Llama output), so AUTO uses the CPU there.
  • Vulkan / OpenCL fixes: Vulkan-Hpp dispatcher initialised with the logical device (#157); lazy OpenCL backend context in ggml's buffer-type callbacks (#156); Adreno quantized-matmul tile fix (#219, #231).

Performance

  • Android arm64 CPU variants (#159): every ggml CPU variant ships as a GGML_BACKEND_DL module and the best one is loaded at run time — i8mm / SVE2 / SME kernels on newer phones (5–8 % faster on a Galaxy S22+), and no more SIGILL on ARMv8.0/8.1 cores (Cortex-A53/A57/A72/A73).
  • iOS CPU variants (#161): FP16, dot-product and int8-matmul kernels on A11/A13/A15+ chosen at run time over an ARMv8.0 baseline, so A9/A10 iPads stay supported.
  • Precompiled, lazily loaded Metal libraries (#243): the first engine load on a fresh iPhone install no longer spends ~13 s compiling shader source on the device (even with CPU_ONLY); Metal kernels are precompiled at build time and loaded only when Metal is used.
  • Android AUTO policies (#160, #245): Whisper and Llama AUTO resolve to the CPU on Android (measured faster than OpenCL on Adreno, without the first-load kernel compile). Explicit GPU_OPENCL / GPU_VULKAN requests still use the GPU. OpenCL kernels are cached in the app's cache directory.
  • AUTO_THREADS (#241): counts only physical cores within 75 % of the top capacity tier, capped at 4 (e.g. Tensor G6 now uses 4 cores instead of 7).
  • PlatformLock (#149): replaces the spin lock and hints the abort-gate spin.

Platforms & distribution

  • Windows x64 desktop Vulkan (#92): kggml-runtime-vulkan now ships ggml-vulkan.dll; GPU_VULKAN works and AUTO picks it when a Vulkan driver is present.
  • Swift Package Manager (#162): the root Package.swift exposes GgmlRuntime, KggmlWhisper, KggmlLlama and KggmlDiffusion binary targets for the latest release; pin this release with the branch swiftpm/v0.2.0. The README also has a Gradle helper that downloads, verifies and links the xcframeworks for Kotlin/Native test executables.
  • API reference (#153): Dokka KDoc for every module, published to GitHub Pages at https://donfuldauer.github.io/kggml/, plus HTML javadoc jars on Maven Central.
  • Nightly snapshots (#199, #235): -SNAPSHOT builds of main are published to the Central Portal snapshot repository, with their iOS xcframeworks on the rolling snapshot-<version> pre-release.
  • SBOMs: a CycloneDX SBOM per module is attached to this release (*.cdx.json).
  • Sample apps (#134, #280): the showcase and whisper-only-minimal are standalone projects built against the published BOM; the showcase displays fallback reasons and active GPU names.

Upgrading from 0.1.0

Pre-1.0 source/binary changes (all others are additive; kggml-*/api/ holds the Kotlin ABI dumps and kggml-*/native/abi/ the exported C symbols, checked on every PR from now on, #150):

  • BackendConfig.useFlashAttention is Boolean? instead of Boolean (#158). Code that reads it as Boolean must handle null; leaving it unset now enables flash attention for Whisper.
  • Accidental public API removed (#187): the Whisper streaming building blocks (OverflowPolicy, PcmRingBuffer, VadState, TurnEndReason, SpeechTurn, VadTurnDetector, WindowFloor) are now internal (VadConfig stays public); SerialDispatcherFactory and SerialExecutor in kggml-core-api are now @InternalKggmlApi (#144, opt-in required).
  • kggml-model-manager's JVM/Android file facade class is renamed from Platform_jvmCommonKt to ModelPlatform (only matters to Java callers; Kotlin call sites are unchanged).
  • WhisperEngine and LlamaEngine with ComputeBackend.AUTO now run on the CPU on Android; request GPU_OPENCL / GPU_VULKAN explicitly to keep the previous behaviour.

iOS & macOS XCFrameworks

Prebuilt dynamic XCFrameworks are attached to this release along with SHA256SUMS and the release's Package.swift:

  • GgmlRuntime.xcframework.zip (ios-arm64, ios-arm64-simulator, macos-arm64)
  • KggmlWhisper.xcframework.zip (ios-arm64, ios-arm64-simulator)
  • `KggmlLlama.xcfram...
Read more

Kggml v0.1.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 22:34

Initial pre-1.0 release of Kggml (com.donfuldauer), a modular on-device AI SDK for Kotlin Multiplatform wrapping ggml (whisper.cpp, llama.cpp + libmtmd, and stable-diffusion.cpp) across Android, iOS, macOS, and JVM Desktop.

Status: pre-1.0. Public APIs may still change between 0.x minor releases. Stability criteria for 1.0.0 are tracked in #104.

Maven Central (com.donfuldauer:kggml-bom:0.1.0)

Import the BOM once and add only the modules your app uses—unused engines add no native code:

dependencies {
    implementation(platform("com.donfuldauer:kggml-bom:0.1.0"))

    implementation("com.donfuldauer:kggml-whisper")        // speech-to-text (whisper.cpp)
    implementation("com.donfuldauer:kggml-llama")          // text generation, embeddings, vision (llama.cpp + libmtmd)
    implementation("com.donfuldauer:kggml-diffusion")      // text-to-image (stable-diffusion.cpp)
    implementation("com.donfuldauer:kggml-model-manager")  // optional: resumable SHA-256 downloads, RAM estimator, cache
    implementation("com.donfuldauer:kggml-runtime-vulkan") // optional: GPU via Vulkan (Android API 28+, desktop Linux x86_64)
    implementation("com.donfuldauer:kggml-runtime-opencl") // optional: Android GPU via OpenCL (Adreno, API 28+)
}

Published coordinates

Coordinate Targets / Native artifacts
com.donfuldauer:kggml-bom BOM (pom) aligning all 8 library coordinates below
com.donfuldauer:kggml-core-api Pure Kotlin: Android, JVM, iosArm64, iosSimulatorArm64, macosArm64
com.donfuldauer:kggml-runtime Shared ggml runtime (CPU everywhere, Metal on Apple). Android AAR (arm64-v8a, x86_64), JVM jar (linux-x86_64, linux-aarch64, windows-x86_64, windows-aarch64, macos-aarch64), iOS & macosArm64
com.donfuldauer:kggml-runtime-vulkan Optional Vulkan GPU add-on: Android AAR (arm64-v8a, x86_64), JVM jar (linux-x86_64); no-op on other platforms
com.donfuldauer:kggml-runtime-opencl Optional OpenCL GPU add-on: Android AAR (arm64-v8a, x86_64); no-op on other platforms
com.donfuldauer:kggml-whisper WhisperEngine (one-shot + live streaming with native resampler & VAD, iOS Core ML encoder & CPU-only background safety)
com.donfuldauer:kggml-llama LlamaEngine (streaming generation, GBNF / JSON Schema grammars, KV-cache sessions, embeddings, in-memory VLM via libmtmd)
com.donfuldauer:kggml-diffusion DiffusionEngine (SD 1.x / 2.x / XL / Flux / SD 3.5 image generation with step progress and cancellation)
com.donfuldauer:kggml-model-manager Pure Kotlin: resumable HTTP Range downloads, SHA-256 verification, GGUF/Whisper header RAM estimator, memory-pressure cache eviction

iOS & macOS XCFrameworks

Prebuilt dynamic XCFrameworks are attached to this release along with SHA256SUMS:

  • GgmlRuntime.xcframework.zip (ios-arm64, ios-arm64-simulator, macos-arm64)
  • KggmlWhisper.xcframework.zip (ios-arm64, ios-arm64-simulator)
  • KggmlLlama.xcframework.zip (ios-arm64, ios-arm64-simulator)
  • KggmlDiffusion.xcframework.zip (ios-arm64, ios-arm64-simulator)

Verify downloads before embedding in your Xcode target:

shasum -a 256 -c SHA256SUMS

Pinned upstream libraries

  • ggml: v1.1.1 (bb877c0)
  • whisper.cpp: v1.9.6-181-g79b11911 (79b1191)
  • llama.cpp + libmtmd: b12816 (7b74cb9)
  • stable-diffusion.cpp: 3b4d26f (master-612-d7ecbe1-2-g3b4d26f)
  • Vulkan-Headers v1.4.369, SPIRV-Headers f6f78c7, OpenCL-Headers 82f6031

See NOTICE for complete attribution and licenses.

Known limitations in 0.1.0

  • PowerVR Vulkan exclusion: Imagination PowerVR GPUs (e.g., Pixel 10/11 Tensor) are excluded from Vulkan by default and fall back to CPU (KGGML_VULKAN_ALLOW_POWERVR=1 overrides).
  • Desktop Vulkan: kggml-runtime-vulkan currently ships a desktop module for linux-x86_64 only; Windows desktop Vulkan is tracked in #92.
  • Kotlin/Native macOS: macosArm64 is published for kggml-core-api and kggml-runtime; engine targets follow in #93.