Kazeia-engine/dist/jni
Richard Loyer 8c1e83be18 chantier B unification #1 : engine 3/3 prêt pour intégration (STT + TTS + LLM)
Reproche du user juste : j'ai livré STT complet mais pas TTS ni LLM au même
niveau. Cette session corrige : 3 docs d'intégration équivalentes en qualité,
2 bugs in-app investigués et l'un fixé.

Investigation TTS "crashe au load in-app" :
 - DT_NEEDED de libkazeia_tts.so = libllama.so + libggml.so + libggml-base.so
   + libggml-cpu.so + libc++_shared.so + libdl/libm/libc
 - Test reproduction sur tablette : lib charge OK avec les 7 deps présentes,
   crash avec "library libllama.so not found" si une dep manque
 - Conclusion : c'est juste 7 libs à pousser dans jniLibs/arm64-v8a/, pas un
   bug code. Liste exhaustive donnée dans TTS_INTEGRATION.md §2.b

Investigation LLM "ne tient pas 8 threads in-app" :
 - kazeia_engine_jni.cpp ligne 117/120/124/131 : n_threads HARDCODE à 4
   pour le decode CPU. Pas exposé côté Kotlin.
 - Fix : ajouter param nThreads à load(), N_DECODE défaut 6 (sweet spot r3
   mesuré : Qwen3.5-4B 9.8 tok/s à t=6 vs 7.4 à t=8 contention)
 - Update EngineJni.load(model, ctx, nThreads) + EngineLlmEngine(ctx, nThreads=6)
 - Rebuild libkazeia_engine.so 60 KB

Docs livrées (format identique STT_INTEGRATION.md) :
 - TTS_INTEGRATION.md (10 KB) : libs à pousser, façade, clonage vocal,
   sampling, codes erreur, bench, checklist, pièges
 - LLM_INTEGRATION.md (10 KB) : option C HTP/CPU, n_threads sweet spot,
   modèles supportés (Qwen3 dense / Qwen3.5 hybride GDN), cascade
   Speaker+Thinker, piège affinity Android (decode 9.8 -> 0.32 tok/s in-app
   si scheduler pin sur 1 cœur)
 - KAZEIA_ENGINE_OVERVIEW.md actualisé : entrée unique pointant les 3 docs,
   pattern dispatch flag (mirror STT pour LLM+TTS), état réel 3/3 prêt

Reste côté dev (cf KAZEIA_ENGINE_OVERVIEW.md):
 1. Pousser les libs jniLibs (8 fichiers pour TTS/LLM, partagées entre eux)
 2. Copier les 3 façades Kotlin
 3. Câbler 2 flags dispatch supplémentaires (llmEngine + ttsEngine, mirror STT)
 4. Valider checklist §7 de chaque doc (System.loadLibrary + 1 call)
 5. Bench A/B prod vs lib sur audios/prompts fixtures

Le pattern STT a marché parce qu'il avait tout (lib + façade + doc + checklist).
Maintenant TTS et LLM aussi.
2026-06-01 15:46:20 +02:00
..
EngineLlmEngine.kt chantier B unification #1 : engine 3/3 prêt pour intégration (STT + TTS + LLM) 2026-06-01 15:46:20 +02:00
SttEngine.kt chantier B STT #2 : S2 + S3 livrés (stt_engine ORT QNN + JNI + façade Kotlin + doc) 2026-05-31 22:15:58 +02:00
TtsEngine.kt TU sampler tuning : top_p 1.0->0.95 + rep_penalty 1.05->1.10 nouveaux défauts 2026-05-31 11:18:25 +02:00
build_prefill.cpp chantier B TTS #4: P3.1+P3.2 = x_vector + prefill_embeds depuis input_ids (bit-exact) 2026-05-28 15:05:23 +02:00
cp_inference.cpp T2.1 CP heads NEON 16-way: CP -33%, pipeline -16%, bit-exact 2026-05-29 17:26:54 +02:00
cp_inference.h chantier F (CP HMX) : path sched livré, gain absent (overhead per-call) 2026-05-29 16:03:41 +02:00
cp_validate.cpp chantier B TTS #5: P3.3 = vrai CP runner intégré (bit-exact) 2026-05-28 15:11:07 +02:00
decoder_subprocess.cpp Decoder chraac en sous-process : -20% decoder, -9% pipeline, talker intact 2026-05-30 18:14:09 +02:00
dual_ctx.cpp dist: prefill HTP = CASSÉ (sortie charabia), prefill obligatoirement CPU 2026-05-27 09:42:59 +02:00
dual_ctx_mt.cpp dist: JNI option C câblé (prefill HTP / decode CPU), validé multi-tour 2026-05-27 10:24:55 +02:00
kazeia_engine_jni.cpp chantier B unification #1 : engine 3/3 prêt pour intégration (STT + TTS + LLM) 2026-06-01 15:46:20 +02:00
kazeia_mel.cpp chantier B STT #6 : 2 bugs critiques fixés grâce à l'A/B in-app du dev 2026-06-01 12:19:33 +02:00
kazeia_mel.h chantier B STT #1 : S1 unification engine (mel partagé + skeleton stt + VAD C++) 2026-05-31 19:19:28 +02:00
kazeia_stt_jni.cpp chantier B STT #2 : S2 + S3 livrés (stt_engine ORT QNN + JNI + façade Kotlin + doc) 2026-05-31 22:15:58 +02:00
kazeia_text_tokenizer.cpp chantier B TTS #10: tokenizer Qwen3 BPE via llama_tokenize, texte arbitraire 2026-05-28 21:21:53 +02:00
kazeia_text_tokenizer.h chantier B TTS #10: tokenizer Qwen3 BPE via llama_tokenize, texte arbitraire 2026-05-28 21:21:53 +02:00
kazeia_tts_jni.cpp chantier B TTS #11: libkazeia_tts.so + Kotlin wrapper, JNI validé bout-en-bout 2026-05-28 21:54:21 +02:00
sampler.cpp chantier B TTS #7: sampler HF-style top_k+top_p+rep_penalty (générique) 2026-05-28 16:55:05 +02:00
sampler.h chantier B TTS #7: sampler HF-style top_k+top_p+rep_penalty (générique) 2026-05-28 16:55:05 +02:00
speaker_encoder.cpp chantier B STT #1 : S1 unification engine (mel partagé + skeleton stt + VAD C++) 2026-05-31 19:19:28 +02:00
speaker_encoder.h chantier B TTS #8 : speaker encoder embedded + clonage in-process 2026-05-31 15:54:29 +02:00
stt_cli.cpp chantier B STT #6 : 2 bugs critiques fixés grâce à l'A/B in-app du dev 2026-06-01 12:19:33 +02:00
stt_engine.cpp chantier B STT #6 : 2 bugs critiques fixés grâce à l'A/B in-app du dev 2026-06-01 12:19:33 +02:00
stt_engine.h chantier B STT #1 : S1 unification engine (mel partagé + skeleton stt + VAD C++) 2026-05-31 19:19:28 +02:00
stt_test.cpp chantier B STT #1 : S1 unification engine (mel partagé + skeleton stt + VAD C++) 2026-05-31 19:19:28 +02:00
test_engine.c Valide device: generate() bout-en-bout OK (test_native), bridge pret integration 2026-05-24 22:05:44 +02:00
test_engine.cpp Valide device: generate() bout-en-bout OK (test_native), bridge pret integration 2026-05-24 22:05:44 +02:00
test_engine_2calls.cpp chantier B TTS #11: libkazeia_tts.so + Kotlin wrapper, JNI validé bout-en-bout 2026-05-28 21:54:21 +02:00
test_jni_native.cpp dist: multi-tour propre (generateRaw + ChatSession) + JNI validé end-to-end natif 2026-05-27 11:18:20 +02:00
test_jni_tts.cpp chantier B TTS #11: libkazeia_tts.so + Kotlin wrapper, JNI validé bout-en-bout 2026-05-28 21:54:21 +02:00
test_native.cpp v4 fix #277: ngl0 CPU decode 14tok/s, 4s/tour, usable 2026-05-25 10:18:31 +02:00
test_talker.cpp chantier B TTS #1: API JNI embeds-only + M-RoPE qwen3 dense 2026-05-28 13:37:17 +02:00
test_talker_replay.cpp chantier B TTS #2: fix M-RoPE positions en embeds-mode + validation bit-exact 2026-05-28 13:54:03 +02:00
test_tokenizer.cpp chantier B TTS #10: tokenizer Qwen3 BPE via llama_tokenize, texte arbitraire 2026-05-28 21:21:53 +02:00
tts_engine.cpp chantier B TTS #8 : speaker encoder embedded + clonage in-process 2026-05-31 15:54:29 +02:00
tts_engine.h chantier B TTS #8 : speaker encoder embedded + clonage in-process 2026-05-31 15:54:29 +02:00
tts_orchestrate.cpp chantier B TTS #6: P3.4+P3.5 = pipeline complet 100% tablette bout-en-bout 2026-05-28 15:25:00 +02:00
tts_pipeline.cpp chantier B STT #1 : S1 unification engine (mel partagé + skeleton stt + VAD C++) 2026-05-31 19:19:28 +02:00