Skip to content

feat(kllama,kgemma): add iosArm64/iosSimulatorArm64 targets; document the target matrix (#271) - #274

Merged
michalharakal merged 1 commit into
developfrom
fix/kllama-ios-targets-271
Aug 10, 2026
Merged

michalharakal merged 1 commit into
developfrom
fix/kllama-ios-targets-271

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

What

runtime-kllama and runtime-kgemma published no iOS artifacts, even though every commonMain dependency of both modules already ships iOS variants — and kllama's src/iosMain (the registerPlatformBackends actual) predated the targets and was silently dead code. These modules set kotlin.mpp.applyDefaultHierarchyTemplate=false, so a source folder means nothing until it's wired by hand. Full analysis in #271.

How

  • Declare iosArm64() + iosSimulatorArm64() in both modules, library-only (no CLI executable for Apple — consumers link the klib into their app).
  • Wire iosMain → nativeMain by hand, mirroring llm-core's wiring. kllama's existing iosMain/BackendActual.kt now actually compiles; kgemma has no iOS-specific sources and inherits nativeMain.
  • kgemma's JVM-only deps (compile-hlo, gemma-iree, llm-providers, …) are already confined to jvmMain, so its commonMain is iOS-clean.
  • README: new Supported targets matrix (module × target, derived from each module's build.gradle.kts) replacing the "where applicable" hand-wave, plus the multiplatform feature bullet now links to it.

Verified (Linux host)

  • All four iOS klibs compile: compileKotlinIosArm64 / compileKotlinIosSimulatorArm64 for both modules (Kotlin/Native builds Apple klibs on any host; only final binary linking needs Xcode). This exercises expect/actual resolution (registerPlatformBackends, createOptimalKvCache) and resolves every dependency's iOS variant.
  • compileIosMainKotlinMetadata / compileNativeMainKotlinMetadata green.
  • jvmTest of both modules green; compileKotlinLinuxX64 green (no regression to existing targets).
  • The publish workflow already runs on macOS-latest, so the new artifacts build in CI as-is. No ABI dump changes needed (BCV dumps are jvm/android-only).

Pre-existing, untouched: :llm-runtime:kllama:jvmApiCheck fails identically on clean develop — the api/jvm/kllama.api dump is stale from the GenerationConfig.prefillStrategy change (#226). Happy to file/fix that separately.

We can validate the resulting klibs in a real iOS app (this is the exact dependency shape our shipped app needed) as soon as a snapshot with these targets is available.

Closes #271

🤖 Generated with Claude Code

… the target matrix

runtime-kllama and runtime-kgemma published no iOS artifacts even though
every commonMain dependency of both modules already ships iOS variants,
and kllama's src/iosMain (the registerPlatformBackends actual) predated
the targets and was silently dead code — these modules set
kotlin.mpp.applyDefaultHierarchyTemplate=false, so a source folder means
nothing until it is wired by hand.

Declare iosArm64 + iosSimulatorArm64 in both modules and wire
iosMain -> nativeMain the same way llm-core does. Library-only targets:
no CLI executable is declared for Apple, consumers link the klib into
their app. kgemma's JVM-only deps (compile-hlo, gemma-iree,
llm-providers, ...) are already confined to jvmMain, so its commonMain is
iOS-clean.

Also add a supported-targets matrix to the README (derived from each
module's build.gradle.kts) and point the multiplatform feature bullet at
it, replacing the 'where applicable' hand-wave.

Verified on a Linux host: all four iOS klibs compile
(compileKotlinIosArm64 / IosSimulatorArm64 for both modules — K/N builds
Apple klibs on any host; only binary linking needs Xcode), iosMain and
nativeMain metadata compile, jvmTest of both modules green,
linuxX64 compile green. Note: :llm-runtime:kllama:jvmApiCheck fails
identically on clean develop (stale api dump from the prefillStrategy
change, #226) — unrelated, not touched here.

Closes #271

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.

runtime-kllama / runtime-kgemma publish no iOS artifacts — kllama's iosMain exists but is never compiled

1 participant