Kazeia-engine/dist/jni
Richard Loyer 101d1cd7ed tests infra HTP/HMX : verdict, le HTP n'est pas le bon outil pour TTS
5 tests systématiques sur les hypothèses non-explorées :

A. USE_HMX=0 vs USE_HMX=1 sur sched CP :
   - HVX 20% plus rapide que HMX à batch=1 (tile 32×32 sous-utilisé)
   - Mais aucun ne bat baseline CPU (110 ms/frame)
   - HVX et HMX bit-exact entre eux ; les deux divergent de CPU (codes
     différents -> trajectoire talker diverge -> N=64 vs 33).

B. op_offload=true vs false : false -16% sur CP HMX (placement strict
   moins coûteux). Quick win retenu (env KZTTS_CP_OFFLOAD).

C. Profile fin (KZTTS_CP_PROFILE=1) par sub-step :
   - sched_reset+alloc : 0.1 ms (négligeable !)
   - tensor_set/get : 0.0 ms (opt_hostbuf=1 = ION partagé)
   - compute : 6-11 ms (95 % du temps !)
   -> L'overhead sched n'est PAS le problème. Le compute HTP
      lui-même est plus lent que CPU pour batch=1. Hypothèse #1
      (sched_reserve + ctx persistant) INVALIDÉE.

D. Talker option C (use_htp=true, GGML_HEXAGON_GDN_PREFILL=1) :
   - Prefill : 87 ms -> 185 ms (+112%)
   - Talker per-frame : 32 ms -> 81 ms (+154%)
   -> Pour un petit modèle (0.6B), l'overhead routing HTP par token
      dépasse le gain compute. Le pattern option C documenté
      marche pour Qwen3.5-4B, PAS pour Qwen3-TTS-Talker.

VERDICT GLOBAL : le HTP est non-rentable sur TOUS nos workloads TTS.
- BigVGAN : bloqué (nrows > 1024)
- CP : régresse (batch=1)
- Talker : régresse (trop petit pour amortir routing)

CLAUDE.md le notait partiellement ('CPU NEON bat HVX 3.4× sur M=1') mais
on n'avait pas tiré la conséquence globale : notre TTS n'a pas de
workload HTP-friendly.

LEVIERS RESTANTS (sans HTP) :
1. Streaming pipeline (1 session) : RTF inchangé mais TTFB 5s->500ms
2. Réduction overhead CP CPU (½ session) : ctx réutilisé entre sub-forwards
3. Decoder optim NEON conv1d : R&D long
4. Quantization Q8/Q4 CP : compromis qualité

Code committé reste opt-in (KZTTS_CP_HTP, KZTTS_DECODER_HTP) et neutre
au runtime. Le path par défaut RTF=3.0 est intact.

Détails complets dans dist/PERF_INFRA_TESTS.md.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-29 16:40:56 +02:00
..
EngineLlmEngine.kt chantier B TTS #1: API JNI embeds-only + M-RoPE qwen3 dense 2026-05-28 13:37:17 +02:00
TtsEngine.kt chantier B TTS #11: libkazeia_tts.so + Kotlin wrapper, JNI validé bout-en-bout 2026-05-28 21:54:21 +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 tests infra HTP/HMX : verdict, le HTP n'est pas le bon outil pour TTS 2026-05-29 16:40:56 +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
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 TTS #2: fix M-RoPE positions en embeds-mode + validation bit-exact 2026-05-28 13:54:03 +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
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 F (CP HMX) : path sched livré, gain absent (overhead per-call) 2026-05-29 16:03:41 +02:00
tts_engine.h chantier B TTS #11: libkazeia_tts.so + Kotlin wrapper, JNI validé bout-en-bout 2026-05-28 21:54:21 +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 TTS #11: libkazeia_tts.so + Kotlin wrapper, JNI validé bout-en-bout 2026-05-28 21:54:21 +02:00