Skip to content

io-core: add androidNativeArm32 via 64-bit-only native64Main source set - #842

Merged
michalharakal merged 1 commit into
developfrom
feature/io-core-androidnative-arm32
Jul 20, 2026
Merged

michalharakal merged 1 commit into
developfrom
feature/io-core-androidnative-arm32

Conversation

@michalharakal

@michalharakal michalharakal commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #835 (arm32 half; arm64 landed in #836).

What

Completes androidNative for skainet-io-core by adding androidNativeArm32().

Why it needed more than a target declaration

androidNativeArm32 is 32-bit, where posix ssize_t / size_t are Int — but Long on every
other native target. PosixPreadRandomAccessSource (posix pread) therefore can't sit in the
shared nativeMain: the shared native metadata compile (compileNativeMainKotlinMetadata) rejects
it with "numbers with different bit widths in at least two actual platforms". (The per-target
arm32 compile is fine; only the cross-width shared metadata is not.)

Fix

Introduce a 64-bit-only intermediate source set native64Main (+ native64Test) between
nativeMain and the six 64-bit native targets (ios/macos/linux + androidNativeArm64), and move
PosixPreadRandomAccessSource (and its test) there. nativeMain no longer references the
width-divergent posix API, so it compiles across all native targets including arm32; the posix code
compiles only for the width-uniform 64-bit group. Nothing in commonMain references
PosixPreadRandomAccessSource (only its own test + external file-I/O consumers), so arm32 just
builds without it.

Verification

compileNativeMainKotlinMetadata, compileKotlinAndroidNativeArm32, compileKotlinAndroidNativeArm64,
compileKotlinLinuxX64, and compileTestKotlinMacosArm64 all compile clean.

Unblocks 32-bit ARM Android devices (and any other androidNativeArm32 consumer) for the engine
tokenizer — the last piece for the on-device Moonshine ASR cartridge's text path.

Completes androidNative for skainet-io-core (arm64 landed in #836). The 32-bit
target was blocked because PosixPreadRandomAccessSource uses posix pread, whose
ssize_t/size_t are Int on 32-bit but Long on every other native target — mixing
widths in the shared nativeMain metadata compile is illegal ('numbers with
different bit widths').

Introduces a 64-bit-only intermediate source set native64Main (+ native64Test)
between nativeMain and the six 64-bit native targets, and moves the posix source
there. nativeMain is now width-uniform-agnostic (no posix), so it compiles across
all native incl. androidNativeArm32; the posix code compiles only for the 64-bit
group. Nothing in commonMain references PosixPreadRandomAccessSource (only its own
test + external file-I/O consumers), so arm32 simply builds without it.

Verified: compileNativeMainKotlinMetadata, compileKotlinAndroidNativeArm32,
compileKotlinAndroidNativeArm64, compileKotlinLinuxX64, and
compileTestKotlinMacosArm64 all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@michalharakal
michalharakal merged commit fdc026c into develop Jul 20, 2026
7 checks passed
@michalharakal
michalharakal deleted the feature/io-core-androidnative-arm32 branch July 20, 2026 10:21
MacOS pushed a commit to MacOS/SKaiNET that referenced this pull request Jul 20, 2026
…dag deps

skainet-io-safetensors was jvm/linux-only, blocking on-device (androidNative)
SafeTensors weight loading. Two independent facts make it a clean add:

1. The commonMain deps on skainet-compile-core and skainet-compile-dag are unused
   (no sk.ainet.compile.* reference anywhere in the module) — they were the only
   deps lacking androidNative. Removed.
2. io-safetensors has no posix in its own nativeMain: createRandomAccessSource and
   readTextFile are null stubs and currentTimeMillis uses TimeSource.Monotonic, so
   there is no bit-width metadata issue (unlike io-core, whose posix pread needed
   the native64Main split in SKaiNET-developers#842). File-backed reads route through io-core's
   RandomAccessSource.

After removing the dead deps, commonMain depends only on lang-core + io-core (both
androidNative) + kotlinx, so androidNativeArm32/Arm64 just needed declaring.

Verified: compileNativeMainKotlinMetadata, compileKotlinAndroidNativeArm32/Arm64,
compileKotlinJvm, and jvmTest all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@michalharakal michalharakal mentioned this pull request Jul 25, 2026
MacOS pushed a commit to MacOS/SKaiNET that referenced this pull request Jul 27, 2026
Bump version 0.36.0 -> 0.37.0 (gradle.properties, docs/antora.yml,
README quickstart). Promote CHANGELOG [Unreleased] to [0.37.0]: Lstm
layer (SKaiNET-developers#824), real Dropout masking (SKaiNET-developers#867), LR schedules and mutable
optimizer lr (SKaiNET-developers#866), optional-bias and open Linear (SKaiNET-developers#870, SKaiNET-developers#875),
androidNative IO targets (SKaiNET-developers#836, SKaiNET-developers#842, SKaiNET-developers#845), the SDPA default-scale fix
(SKaiNET-developers#880), three autograd fixes (SKaiNET-developers#877), the argMax DAG output spec (SKaiNET-developers#878),
tokenizer BPE inference and N-D gather (SKaiNET-developers#879), plus the CI/docs
supply-chain hardening and toolchain bumps. Refresh README "What's New"
and add a Contributors (0.37.0) section.

Co-Authored-By: Claude Opus 5 (1M context) <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.

io-core: add androidNativeArm32/Arm64 targets (posix nativeMain already covers them)

1 participant