llm.asm inference (`asm-llm`) multi-threading performance under CPU contention.
Raw Developer Origin & Technical Request
GitHub Issue
Nov 26, 2026
### What happens
When other CPU-bound work competes for the same cores, `asm-llm` with a thread count equal to the number of hardware threads slows down by roughly 20x. Lower thread counts degrade only mildly.
### Measured (decode tok/s, 64 tokens)
| `-t` | quiet machine | while an unrelated 8-thread CPU-bound job runs |
|---:|---:|---:|
| 8 | ~84 | 66–70 |
| 16 | 77–80 | 3.5–3.8 |
The numbers come from a desktop that was not perfectly idle, so treat them as indicative; the size of the drop was consistent across runs. Oversubscription without external load looks the same (see the default `-t 32` issue: 2.3 tok/s on 16 threads).
### Reproduce
```bash
# terminal 1: any 8-thread CPU-bound load, e.g.
./build/asm-gpt-train --data data/tinyshakespeare.txt --steps 1500 --seq 256 -t 8 --plain
# terminal 2:
./build/asm-llm -m models/qwen3-0.6b-q8_0.asmbin -p "Explain how a CPU cache works in 3 concise sentences." -n 64 -t 16
```
### What the code does
- Work is split into one fixed slice per thread, and the main thread waits for every worker in an unbounded `pause` loop (`shared/threads.asm:347-360`).
- Idle workers spin for `SPIN_LIMIT = 200000` iterations before falling back to `futex` (`shared/threads.asm:25`, `:125-133`).
**My guess (not confirmed by profiling):** if any single worker is preempted, the whole matmul waits for it while all other threads keep spinning, and with every hardware thread in use some worker is nearly always preempted.
### Possible mitigations
- Bound...
Developer Debate & Comments
No active discussions extracted for this entry yet.
Adjacent Repository Pain Points
Other highly discussed features and pain points extracted from alesha-pro/llm.asm.
Frequently Asked Questions
Market intelligence mapped to llm.asm inference (`asm-llm`) multi-threading performance under CPU contention..
What is the technical positioning of llm.asm inference (`asm-llm`) multi-threading performance under CPU contention.?
What architecture is tied to llm.asm inference (`asm-llm`) multi-threading performance under CPU contention.?
Engagement Signals
Cross-Market Term Frequency
Counts stored text matches for foundational terms like spinning and asm-llm in analysed public discussions. These counts do not measure adoption.
Stored text matches, not adoption or market-share measurements.
- spinning: 3 records
- asm-llm: 2 records
- decode tok/s: 2 records
- 64 tokens: 2 records
- CPU cache: 2 records
- decode drops ~20x: 1 records
- -t equals hardware threads: 1 records
- other processes compete for the cores: 1 records
- CPU-bound work: 1 records
- quiet machine: 1 records
- unrelated 8-thread CPU-bound job: 1 records
- desktop that was not perfectly idle: 1 records
- oversubscription: 1 records
- external load: 1 records
- default -t 32 issue: 1 records
- Work is split into one fixed slice per thread: 1 records
- main thread waits for every worker: 1 records
- unbounded pause loop: 1 records
- shared/threads.asm:347-360: 1 records
- Idle workers spin for SPIN_LIMIT = 200000 iterations: 1 records
- falling back to futex: 1 records
- shared/threads.asm:25: 1 records
- :125-133: 1 records
- preempted: 1 records
- matmul waits: 1 records
- hardware thread in use: 1 records
- Possible mitigations: 1 records
SaaS Metrics