Skip to content

feat(#1193): derive mapped-serving encodings from kernel registrations - #1215

Merged
michalharakal merged 1 commit into
developfrom
feature/1193-mapped-kernel-derivation
Aug 30, 2026
Merged

michalharakal merged 1 commit into
developfrom
feature/1193-mapped-kernel-derivation

Conversation

@michalharakal

Copy link
Copy Markdown
Contributor

Summary

StorageCapabilities.MAPPED_SERVABLE_DEFAULT (skainet-lang-core) and KernelSupportMatrixTest.mappedTiers() (skainet-backend-native-cpu) were two independently hand-maintained lists of which encodings can actually be served straight from mapped/off-heap storage — nothing checked that they agreed. This closes that gap for #1193.

skainet-lang-core cannot depend on skainet-backend-api (the dependency runs the other way, avoiding a cycle), so StorageCapabilities.MAPPED_SERVABLE_DEFAULT stays a hand-kept constant — but it's now cross-checked against what's actually registered:

  • New MappedCapableKernel marker interface in skainet-backend-api, implemented by FfmRowMajorMatmulKernel (JVM/FFM) and JniRowMajorMatmulKernel (Android/JNI) — the two kernels proven to serve a BLOCKED_ROW_MAJOR weight from off-heap/mapped storage as well as heap bytes.
  • KernelDispatch.mappedServableEncodings() derives the served encodings from whatever MappedCapableKernels are actually registered.
  • KernelSupportMatrixTest.generate_and_gate_support_matrix() installs the JVM-reachable mapped kernel pack and asserts the derived set equals StorageCapabilities.MAPPED_SERVABLE_DEFAULT minus dense F32 (which StorageCapabilities maps as an element view, not a matmul kernel — it has no row in kernel dispatch by design).
  • mappedTiers()'s ffm-rowmajor row is now itself derived instead of a hardcoded literal; the Android native-jni-direct row stays declared, since nothing on a JVM test run can probe whether the JNI .so loads on a device.

Drift between the two lists now fails CI instead of relying on someone remembering to update both by hand.

Test plan

  • ./gradlew :skainet-backends:skainet-backend-api:compileKotlinJvm :skainet-backends:skainet-backend-native-cpu:compileKotlinJvm :skainet-backends:skainet-backend-jni-cpu:compileDebugKotlin
  • ./gradlew :skainet-backends:skainet-backend-native-cpu:jvmTest (including KernelSupportMatrixTest, FfmRowMajorDispatchTest, NativeFfmPipelineTest)
  • ./gradlew :skainet-backends:skainet-backend-api:jvmTest :skainet-backends:skainet-backend-jni-cpu:testDebugUnitTest

StorageCapabilities.MAPPED_SERVABLE_DEFAULT (skainet-lang-core) and
KernelSupportMatrixTest.mappedTiers() (skainet-backend-native-cpu) were two
independently hand-maintained lists of which encodings serve straight from
mapped/off-heap storage, with nothing checking they agreed.

skainet-lang-core cannot depend on skainet-backend-api (that dependency runs
the other way), so the hand-kept constant stays, but it's now cross-checked
against reality: a new MappedCapableKernel marker on FfmRowMajorMatmulKernel
and JniRowMajorMatmulKernel plus KernelDispatch.mappedServableEncodings()
derives the set from what's actually registered, and
KernelSupportMatrixTest.generate_and_gate_support_matrix() installs the
JVM-reachable mapped kernels and asserts the derived set equals
StorageCapabilities.MAPPED_SERVABLE_DEFAULT (minus dense F32, which is mapped
as an element view, not a matmul kernel). mappedTiers()'s ffm-rowmajor row is
now itself derived; the Android native-jni-direct row stays declared, since
nothing on a JVM test run can probe a device's JNI kernel availability.

Closes the loop #1193 asked for: drift between the two lists now fails CI
instead of relying on someone remembering to update both.
@github-actions

Copy link
Copy Markdown

📖 Documentation Preview

The documentation has been built successfully for this PR.

Generated Files:

  • Operator documentation: docs/modules/operators/_generated_/
  • JSON schema output: operators.json

Artifacts:

  • Download the documentation-preview-1215 artifact to view the complete documentation locally.

This comment will be updated automatically when the PR is updated.

@michalharakal
michalharakal merged commit 3295ca5 into develop Aug 30, 2026
24 checks passed
@michalharakal
michalharakal deleted the feature/1193-mapped-kernel-derivation branch August 31, 2026 14:35
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.

1 participant