Commit Graph

1 Commits

Author SHA1 Message Date
Richard Loyer e55cd175c8 chantier B engine #2 : bloqueur SELinux découvert + guide rebuild CPU-only pour dev
Le dev Kazeia a découvert au test de dégel TTS / toggle llm_engine=lib :
SIGABRT in-app au tts_engine_load / kazeia_engine_load, jamais en standalone.

Trace dmesg :
  avc: denied { open } for path="/dev/fastrpc-cdsp"
    scontext=u:r:untrusted_app  tcontext=u:object_r:vendor_qdsp_device

Cause : libggml-hexagon.so dlopen libcdsprpc.so (FastRPC) au init backend HTP,
qui ouvre /dev/fastrpc-cdsp. Policy SELinux Oplus/Qualcomm sur SM8750 interdit
cet accès à untrusted_app (UID 10xxx). Seul shell (UID 2000) y a accès.

Conséquence : tout mon harness CLI standalone via adb shell était un FAUX
positif systématique. Le test "loadLibrary OK" + "calls C++ OK" ne révèle
rien du comportement in-app pour le backend HTP/DSP.

Pourquoi STT marche : passe par libQnnHtp.so Maven (delegation autorisée
untrusted_app), pas FastRPC direct.

Pourquoi ExecuTorch .pte marche : idem libQnn Maven.

3 voies évaluées (cf project_engine_selinux_fastrpc_blocker memoire) :
 1. Rebuild CPU-only (GGML_HEXAGON=OFF) -- réaliste, +1s/tour LLM, +0 TTS
 2. Port ORT-QAIRT pour LLM -- non réaliste (pas de Qwen QAIRT context)
 3. Statu quo .pte -- régression ambition projet

Décision user : le dev rebuilde de son côté en environnement APK réel
(évite mon harness biaisé). Reprise des sources Kazeia-Engine et build.

Livrables cette session :
 - dist/REBUILD_CPU_ONLY.md : guide complet 7 étapes (sources, flags CMake,
   build libllama/ggml CPU-only, rebuild kazeia_engine/tts, jniLibs allégé,
   tests in-app, perf attendue, points d'attention)
 - dist/LLM_INTEGRATION.md §0 : bloqueur SELinux documenté + référence
   rebuild CPU-only + chiffres perf attendus
 - dist/TTS_INTEGRATION.md §0 : idem côté TTS, noter que le clonage vocal
   (speaker encoder ECAPA-TDNN) est CPU-only de base, donc préservé sans
   impact
 - dist/KAZEIA_ENGINE_OVERVIEW.md : warning en tête + pointer REBUILD doc
 - project_engine_selinux_fastrpc_blocker.md : diagnostic complet pour
   contexte futur

Coût mesuré attendu (vs CLI HTP) :
 - LLM prefill : 0.4s -> 1.3s (+0.9s)
 - LLM decode : inchangé (déjà CPU NEON option C)
 - TTS talker prefill : 50ms -> 150ms (négligeable in-mix)
 - Tour LLM total : +1s (acceptable thérapeutique)
 - Tour TTS total : +0.1s (imperceptible)

Leçon de méthode gravée : un harness CLI via adb shell sera TOUJOURS
faux positif pour tout test impliquant FastRPC/DSP/contexte vendor.
Tout test validation engine pour intégration in-app DOIT passer par
APK debug ou androidTest instrumenté.
2026-06-02 23:12:38 +02:00