[Bug]: d3 decision requests keep ~13 CPU cores busy (thread pool spin-waits); no way to cap threads

Ouverte
#882 2 commentaires 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

@tawei-amd y travaille déjà.

Depuis le 30/10/2026.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
45/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
cpp

Piste de recherche

Start by tracing the d3 decision request path and its CPU matmul and NPU completion handling; the report identifies d3_npu.dll symbols cpu_mm, cpu_func, and lm_head, plus hardware_concurrency as entry points. Reproduce with back-to-back /v1/systemone requests while measuring CPU use and latency. Done means decision threads can be capped and NPU waiting no longer causes sustained CPU spinning, with latency and CPU measurements reported.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Environment: FastFlowLM 1.0.11, Windows 11 Pro 26200, Ryzen AI 9 HX PRO 475 (12 cores / 24 threads, XDNA 2), NPU driver 32.0.20102.3930. flm serve --decision d3:nano (no chat model loaded).

What we see: back-to-back /v1/systemone requests run at about 0.40 s each with the NPU busy roughly 56% of the time, but flm.exe uses 12.9 cores (54% of all logical CPUs) while doing so: about 5.3 CPU-seconds per 0.4 s decision, 37% of it kernel time, spread over about 25 threads at about 44% each. At idle the server uses 0 CPU. A chat model on the same server (qwen3.6-moe:35b-a3b decode) uses only about 4% CPU, so this is specific to the decision path.

Restricting CPU affinity shows about half of it is waiting, not work:

flm.exe CPU affinity Decision median CPU used Kernel share
24 logical CPUs (default) 399 ms 12.9 cores 37%
8 logical CPUs 426 ms (+7%) 6.4 cores 68%
2 logical CPUs 822 ms 1.8 cores 40%

d3_npu.dll contains CPU matmul paths (cpu_mm, cpu_func, lm_head, AVX-512) and sizes its pool from hardware_concurrency. It looks like the worker threads spin and yield while the NPU runs.

Impact: a decision stream next to other CPU work slows both. With llama.cpp chat on the CPU at the same time, decisions went from 400 to 527 ms (+32%) and chat dropped 13%.

Requests:

  1. An option or env var to cap the decision path's CPU threads (for example --threads or FLM_CPU_THREADS).
  2. Block on the NPU completion (fence or event) instead of spin-waiting, or spin briefly and then sleep.

Happy to re-test a build on this machine.

Langage dominant
C++
Étoiles
2.1k
Forks
184
Merge moyen
12 h 22 min
PR mergées (30 j)
239

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de ROCm/FastFlowLM

Toutes les issues de ROCm/FastFlowLM

Issues similaires

Plus d'issues C++

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.