Dense FP32 (and FP16) matmul on the Android JNI tier: attention runs scalar today
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- machine-learning, mobile, performance
Hướng nghiên cứu
Start by reading fp32_matmul.c, fp16_matmul.c, and the JNI exports in native/skainet_jni.c; then trace how JniKernelProvider registers kernels and review JniKernelParityTest and KernelSupportMatrixTest. Add the requested JNI matmul variants and registrations, verify scalar parity including offset and strided operands, regenerate the support matrix, and measure the whisper-tiny encoder on a device. Done means bit-identical attention-shape results and at least 5× speedup on a Pixel 7 Pro/8a-class phone.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Context
A fully offline Android transcription app built on LiteRT (Whisper large-v3-turbo split encoder/decoder on OpenCL FP16, Parakeet TDT 0.6B, Silero VAD on ONNX Runtime) was evaluated as a SKaiNET consumer. Its author's own measurements on a Pixel 7 Pro are the bar: LiteRT CPU XNNPACK transcribes a 14 s memo in 82.2 s (RTF 5.9); the GPU path needs 34.4 s.
Since 0.50.0 the Android JNI tier (skainet-backend-jni-cpu) serves every GGML quant format from mapped weights on NEON, and 0.52.0 made the dispatch self-installing. That covers the weight side of a Whisper encoder (Q8_0 from whisper.cpp GGUFs, 874 MB). What it does not cover is the activation side.
Gap
The generated kernel support matrix (docs/.../reference/kernel-support-matrix.adoc, 0.54.0) lists Float32 and BFloat16 as scalar on Android, and native/skainet_jni.c exports only q40/q4k/q50/q51/q5k/q6k/q80 matmul entries plus the ternary gemv. A Whisper large-v3-turbo encoder issues, per layer, 20 heads of QKᵀ ([1500,64]×[64,1500]) and AV ([1500,1500]×[1500,64]) as FP32 activation × activation matmuls, 32 layers deep, plus two conv1d stem layers. On Android all of that runs through the scalar Kotlin path, so the quantized weight kernels cannot make the encoder fast on their own.
fp32_matmul.c already exists in skainet-backend-native-cpu (aarch64-verified, see #920) and the JVM reaches it through FFM; Android does not.
Scope
- JNI entries for dense FP32 matmul, including a batched variant and a transposed-right-operand variant (
A × Bᵀ) so attention does not pay a transpose copy per head, using the existingskainet_row_threadspool. - FP16 weight matmul on the JNI tier, since whisper.cpp ships F16 GGUFs and
fp16_matmul.cis in tree (#885 tracks the FFM side of the same kernel). -
JniKernelProviderregistrations soKernelDispatchselects them on Android at the native priority. - Parity tests against
ScalarFp32MatmulKernelinJniKernelParityTest, including offset/strided operands (the #1173 class of bug). -
KernelSupportMatrixTestregenerated:Float32andFloat16shownative-jnion Android. - Device measurement with the M2-A5 harness: whisper-tiny encoder before/after.
Acceptance
- Bit-identical results to the scalar path on device for the attention shapes above.
- whisper-tiny.en encoder on a Pixel 7 Pro / 8a class phone at least 5× faster than the scalar Android baseline.
Related
- #920 — NEON kernels to mobile (the JNI tier this extends)
- #885 — FP16 native kernel on the FFM tier
- #949 — the non-matmul Android overhead this issue does not address (see the companion issue on fused elementwise/norm kernels)
- Ngôn ngữ chính
- Kotlin
- Star
- 52
- Fork
- 15
- Merge trung bình
- 1 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SKaiNET-developers/SKaiNET
-
coding good first issue platform size:xs skill:js sub-issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SKaiNET-developers/SKaiNET#1232 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
compute-backend dsl/api enhancement size:m skill:kotlin-core skill:numerics
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
SKaiNET-developers/SKaiNET#1343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
skeep tracking
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
SKaiNET-developers/SKaiNET#1331 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
assessment size:s skill:review sub-issue
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 18/100
SKaiNET-developers/SKaiNET#1330 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue size:s skill:docs sub-issue
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 78/100
SKaiNET-developers/SKaiNET#1329 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SKaiNET-developers/SKaiNET
Issue tương tự
-
Dev
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
ankidroid/Anki-Android#22555 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Good first issue: add kotlin-spring-boot stack budget preset (Kotlin + Spring Boot 3 + Gradle)Đang mởenhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
core: RAC_LLM_OPTIONS_DEFAULT.min_p disagrees with the IDL's annotated defaultCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởbug core p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
RunanywhereAI/runanywhere-sdks#1083 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Java and Kotlin (JVM): parse gradle/wrapper/gradle-wrapper.properties with exact line locationsĐang mởarea: detector eco: java help wanted lane: free-agent roadmap size: S type: parser
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
arminazimi/evergreen#355 ·
Maintainer thường phản hồi trong vòng 1 ngày