[PR #14] [MERGED] CPU pool: fix dangling else in Linux physical_cores() (fixes #13, root cause of #11) #2414

Closed
opened 2026-11-04 01:59:56 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/14
Author: @Vistawizard
Created: 9/26/2026
Status: ✅ Merged
Merged: 9/26/2026
Merged by: @Niko1221

Base: main ← Head: fix/linux-cpu-pool-affinity


📝 Commits (1)

  • f333c71 CPU pool: fix dangling else in the Linux physical_cores() branch

📊 Changes

1 file changed (+3 additions, -2 deletions)

View changed files

📝 src/kernels/cpu/pool.cpp (+3 -2)

📄 Description

Fixes #13. Root cause of #11.

In physical_cores() (Linux branch), the else had no braces, so it bound to the inner if (CPU_ISSET(i, &set)) instead of the sched_getaffinity check. Every CPU id outside the affinity mask then appended all hardware_concurrency() ids again: on a 16-CPU machine, (1024 − 16) × 16 + 15 = 16 143 pool workers, load average > 10 000, and the server never becomes ready.

This PR braces both branches, so the fallback only runs when sched_getaffinity fails. Behaviour on Windows is unchanged.

Tested on Debian 13 (Proxmox LXC, 16 CPUs), RTX 3060 12 GB, Ryzen 9 5950X, IQ2_XS, 32K context:

  • before: 16143 expert-pool workers, hang
  • after: 15 expert-pool workers + the host thread, ready in 48 s, ~40.5 tok/s decode, 421 tok/s prefill (16.5K prompt)

With this, the --pool-workers workaround from #11 is no longer needed.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q1SEDU9H9DCuipw7SB1haY


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Niko1221/Strata/pull/14 **Author:** [@Vistawizard](https://github.com/Vistawizard) **Created:** 9/26/2026 **Status:** ✅ Merged **Merged:** 9/26/2026 **Merged by:** [@Niko1221](https://github.com/Niko1221) **Base:** `main` ← **Head:** `fix/linux-cpu-pool-affinity` --- ### 📝 Commits (1) - [`f333c71`](https://github.com/Niko1221/Strata/commit/f333c71db79ef2b618cb877720162ced37a27f51) CPU pool: fix dangling else in the Linux physical_cores() branch ### 📊 Changes **1 file changed** (+3 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cpu/pool.cpp` (+3 -2) </details> ### 📄 Description Fixes #13. Root cause of #11. In `physical_cores()` (Linux branch), the `else` had no braces, so it bound to the inner `if (CPU_ISSET(i, &set))` instead of the `sched_getaffinity` check. Every CPU id outside the affinity mask then appended all `hardware_concurrency()` ids again: on a 16-CPU machine, `(1024 − 16) × 16 + 15` = **16 143 pool workers**, load average > 10 000, and the server never becomes ready. This PR braces both branches, so the fallback only runs when `sched_getaffinity` fails. Behaviour on Windows is unchanged. **Tested** on Debian 13 (Proxmox LXC, 16 CPUs), RTX 3060 12 GB, Ryzen 9 5950X, IQ2_XS, 32K context: - before: `16143 expert-pool workers`, hang - after: `15 expert-pool workers + the host thread`, ready in 48 s, ~40.5 tok/s decode, 421 tok/s prefill (16.5K prompt) With this, the `--pool-workers` workaround from #11 is no longer needed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q1SEDU9H9DCuipw7SB1haY --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-04 01:59:56 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Niko1221/Strata#2414
No description provided.