Skip to content

Investigate intermittent CPU threadpool stalls on Tensor G6 #255

Backlog

Description

@leehack

Observed behavior

On DDP Pixel 11 Pro (Tensor G6), two of four persistent llama.cpp pool threads intermittently share one core while other big cores sit idle. Prefill drops to 6–8 tok/s (TTFT 3.1–4.2 s vs ~0.1 s), or a whole Gemma 4 E2B generation runs at 3.3 tok/s vs ~24. Placement usually recovers after ~5 s.

The real Dart CPU path at 7711167774 saw 6 stalls in ~140 CPU generations on Pixel 11 Pro, 0/88 on Pixel 11, and 0/112 on Pixel 9 Pro. An earlier Pixel 11 native sweep saw bench_taskset_mid t=3 at 5.73 vs 49.28 tok/s. In session 6ef4139f-6d86-43a0-b48e-fbed168eac9f, qwen-auto_m logged worker ticks 185@cpu5 185@cpu3 93@cpu6 92@cpu6, with cpu2/cpu4 at 2–3% busy and Thermal Status 0.

Next experiment

The v1.1.0-2 wrapper starts from default pool parameters without a CPU mask or strict affinity. Dart passes poll=50. Scheduler packing of spinning workers and wake-affine placement after idle are hypotheses. Strict affinity has yet to be tested through the wrapper. Standalone llama-bench -C 0x78 --cpu-strict 1 -t 4 gave 57.9/56.5 tok/s on the G6 phones, matching unpinned throughput.

Extend ~/ddp-evidence/studio-tensor-672518b/probe/probe-128.c to ~60 cycles of 24-token prefill and 16-token decode, with 1–3 s idle gaps. Log worker ticks and last CPU (/proc/self/task/<tid>/stat field 39) per phase. Compare wrapper poll=50, an owned strict pool with masks 0x78 and 0x3c, non-strict 0x78, and poll=100 on grizzly-37 and cubs-37. Use caiman-35 with strict 0xf0 as the control.

If strict affinity reduces stalls, design placement on the N highest-capacity cores allowed by the process cpuset, accounting for background cpuset changes and thermal core pausing. Add a failing-first case in tests/threadpool_test.cpp, then release the native fix and update the Dart pin.

Related: llamadart-native #254, llamadart #2393, llamadart #2394.

Activity

  1. leehack commented on Nov 29, 2026

    @leehack
    OwnerAuthor

    Triage: bug, priority:P2, area threadpool. Schedule the affinity experiment because the default CPU path can incur multi-second TTFT or a full-response slowdown on Tensor G6. The stalls are transient and do not block 0.23.x.

  2. added
    bug
    priority:P2
    threadpool
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:P2threadpool

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions