Ternary decode on 4× Cortex-A78C: row-thread pool only 40–60 % busy, 1.8 tok/s (BitNet 2B4T) — dispatch-bound, not bandwidth-bound
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 45/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Ambito
- backend, machine-learning, performance
Direzione di ricerca
Start by reading skainet_row_threads.c and the native GEMV entry points NativeTernaryLmheadKernel.lmheadStage1 and NativeTernaryF32GemvKernel.gemvPackedStorage. Profile decode to distinguish row partition and barrier costs from FFM downcall overhead and JVM topK time. Compare throughput and worker utilization after a targeted change; the issue reports 1.8 tok/s and 40–60% worker utilization as the baseline.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
During BitNet b1.58 2B4T decode on a linux-arm64 JVM with the native kernels loaded, the 4 worker cores are only 40–60 % busy, and decode is 1.8 tok/s. The implied weight traffic is about 1.4 GB/s against roughly 24 GB/s of measured DRAM read bandwidth, so decode is neither bandwidth-bound nor compute-saturated. That points at dispatch and row-thread overhead.
For comparison, on the same cores llama.cpp b9868 decodes the same model (TQ2_0, f16 tied head) at 17.3 tok/s.
Setup
- Arduino Ventuno Q (QCS8275),
docker --cpuset-cpus=0-3(4× Cortex-A78C up to 2.36 GHz), Temurin 21.0.12.1. - SKaiNET 0.61.0, native kernels cross-built for linux-arm64 (see https://github.com/SKaiNET-developers/SKaiNET/issues/1356).
skainet-cli -m ggml-model-i2_s.gguf -s 64 -k 0 "The capital of France is", with the two-stage lm_head enabled (BITNET_PLANES, top-200 rescoring).
Measurements
Per-core utilisation from mpstat, sampled every 8 s during decode:
t=49s decode cpu0=56% cpu1=43% cpu2=74% cpu3=61%
t=57s decode cpu0=46% cpu1=39% cpu2=43% cpu3=60%
t=65s decode cpu0=40% cpu1=40% cpu2=44% cpu3=58%
t=73s decode cpu0=42% cpu1=31% cpu2=62% cpu3=40%
The first SKaiNET frame on the main thread, across 12 jcmd Thread.print samples during decode:
| Frame | Samples |
|---|---|
NativeTernaryLmheadKernel.lmheadStage1 |
4 |
NativeTernaryF32GemvKernel.gemvPackedStorage |
4 |
BitNetTwoStageDecode.topK |
2 |
ResidualAdd.onForward |
1 |
JvmVectorKernels.binaryFloat |
1 |
Rebuilding the NeoGPU kernel and its adapter with -mcpu=cortex-a78c instead of the armv8-a pin made no difference (1.82 tok/s).
Questions / suggestions
- Row partitioning and barrier cost in
skainet_row_threads.cfor the many small 2560-wide GEMVs per token (q/k/v/o, gate/up/down × 30 layers). Is one job per GEMV too fine-grained? Could batching q/k/v and gate/up into one pool job help? - Do the FFM downcalls themselves add measurable overhead? 7 of the 10 deep samples were inside
DowncallStub. A per-token batched entry point might help. topKover the 128k-vocab stage-1 scores runs on the JVM main thread while the pool idles. Could it be parallelised or moved native?
- Lingua principale
- Kotlin
- Stelle
- 52
- Fork
- 15
- Merge medio
- 23h 34m
- PR unite (30g)
- 45
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SKaiNET-developers/SKaiNET
-
native-cpu: -Wreturn-type in skainet_row_threads.c:150 (worker fn has no return)Forse già presa @Doomguy-BFG9000 l’ha presa oggi. Apertagood first issue size:xs skill:native
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
SKaiNET-developers/SKaiNET#1358 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
coding good first issue platform size:xs skill:js sub-issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SKaiNET-developers/SKaiNET#1232 ·
I maintainer di solito rispondono entro 1 giorno
-
bug platform skill:native
Difficoltà 4/5 3-5 giorni Idoneità per principianti 58/100
SKaiNET-developers/SKaiNET#1356 ·
I maintainer di solito rispondono entro 1 giorno
-
Ground truth: add Kotlin/Native target(s) to skainet-test-groundtruth (jvm/android only today)Apertaenhancement platform skill:native sub-issue
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
SKaiNET-developers/SKaiNET#1301 ·
I maintainer di solito rispondono entro 1 giorno
-
compute-backend skill:android tracking
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
SKaiNET-developers/SKaiNET#1282 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SKaiNET-developers/SKaiNET
Issue simili
-
cr:missing-repro cr:platform:android missing-repro platform:android
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
software-mansion/react-native-screens#4950 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
software-mansion/enriched-markdown#1033 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno