[PR #4580] [CLOSED] fix(pool): identify Linux physical cores by thread_siblings_list (aarch64 / Tegra, #4578) #5097

Closed
opened 2026-11-07 16:32:40 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Niko1221/Strata/pull/4580
Author: @potoior
Created: 10/29/2026
Status: ❌ Closed

Base: main ← Head: fix/aarch64-cpu-topology


📝 Commits (1)

  • 92b86c5 fix(pool): identify Linux physical cores by thread_siblings_list (#4578)

📊 Changes

1 file changed (+36 additions, -9 deletions)

View changed files

📝 src/kernels/cpu/pool.cpp (+36 -9)

📄 Description

Fixes #4578.

Problem

On some aarch64 SoCs (here a Jetson AGX Thor / Tegra, 14 logical CPUs) every CPU reports topology/core_id = 0 and physical_package_id = 0. The Linux topology reader in src/kernels/cpu/pool.cpp keys a physical core by physical_package_id * 1e6 + core_id, so all CPUs collapsed to one core and the CPU expert pool started a single worker:

strata generate: CPU pool: 1 workers by default (1 physical cores, 14 logical processors; ...)
strata generate: 1 expert-pool workers + the host thread

strata tune auto also reported facts.workers = 1.

Change

Identify the physical core by thread_siblings_list (the logical CPUs that share one core), using the smallest CPU id in the list as the key. On an SMT x86 core the list is e.g. 0,16, which names the same smallest id from both threads, so the grouping is unchanged there; the code falls back to (pkg, core) when the file is absent or unreadable. Sibling lookup (sibling_of) and the physical-core count (p_cores) now use the same key.

Validation (on the affected hardware)

Jetson AGX Thor, aarch64, 14 logical CPUs, source build -DCMAKE_CUDA_ARCHITECTURES=110:

  • Before: CPU pool: 1 workers by default (1 physical cores, 14 logical processors), 1 expert-pool workers + the host thread
  • After: CPU pool: 13 workers by default (14 physical cores, 14 logical processors), 13 expert-pool workers + the host thread
  • Engine starts, serves 256K, /health ok.
  • pool_plan_test: OK (the x86 plan cases are unchanged).
  • pool_test: SKIPPED on aarch64 (needs AVX-512), not a regression.
  • Speed on this workload (experts mostly GPU-resident): decode ~32.9 tok/s, prefill 708/904 tok/s (4K/16K) — unchanged vs the 1-worker default, so this is a correctness/portability fix, not a speed one.

Not done

No new automated test: detect_cpu_topology reads /sys directly (no STRATA_TEST_SYSFS_ROOT hook, unlike cpu_numa_node), so a fake-sysfs unit test would need that hook first. Happy to add one if you want the refactor.

Reproduction status: reproduced and fixed on the machine above.


🔄 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/4580 **Author:** [@potoior](https://github.com/potoior) **Created:** 10/29/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/aarch64-cpu-topology` --- ### 📝 Commits (1) - [`92b86c5`](https://github.com/Niko1221/Strata/commit/92b86c576f9d4f17a7770b761d18e101f208022b) fix(pool): identify Linux physical cores by thread_siblings_list (#4578) ### 📊 Changes **1 file changed** (+36 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/kernels/cpu/pool.cpp` (+36 -9) </details> ### 📄 Description Fixes #4578. ## Problem On some aarch64 SoCs (here a **Jetson AGX Thor / Tegra**, 14 logical CPUs) every CPU reports `topology/core_id = 0` and `physical_package_id = 0`. The Linux topology reader in `src/kernels/cpu/pool.cpp` keys a physical core by `physical_package_id * 1e6 + core_id`, so all CPUs collapsed to one core and the CPU expert pool started a single worker: ``` strata generate: CPU pool: 1 workers by default (1 physical cores, 14 logical processors; ...) strata generate: 1 expert-pool workers + the host thread ``` `strata tune auto` also reported `facts.workers = 1`. ## Change Identify the physical core by `thread_siblings_list` (the logical CPUs that share one core), using the smallest CPU id in the list as the key. On an SMT x86 core the list is e.g. `0,16`, which names the same smallest id from both threads, so the grouping is unchanged there; the code falls back to `(pkg, core)` when the file is absent or unreadable. Sibling lookup (`sibling_of`) and the physical-core count (`p_cores`) now use the same key. ## Validation (on the affected hardware) Jetson AGX Thor, aarch64, 14 logical CPUs, source build `-DCMAKE_CUDA_ARCHITECTURES=110`: - Before: `CPU pool: 1 workers by default (1 physical cores, 14 logical processors)`, `1 expert-pool workers + the host thread` - After: `CPU pool: 13 workers by default (14 physical cores, 14 logical processors)`, `13 expert-pool workers + the host thread` - Engine starts, serves 256K, `/health` ok. - `pool_plan_test`: **OK** (the x86 plan cases are unchanged). - `pool_test`: **SKIPPED** on aarch64 (needs AVX-512), not a regression. - Speed on this workload (experts mostly GPU-resident): decode ~32.9 tok/s, prefill 708/904 tok/s (4K/16K) — **unchanged** vs the 1-worker default, so this is a correctness/portability fix, not a speed one. ## Not done No new automated test: `detect_cpu_topology` reads `/sys` directly (no `STRATA_TEST_SYSFS_ROOT` hook, unlike `cpu_numa_node`), so a fake-sysfs unit test would need that hook first. Happy to add one if you want the refactor. Reproduction status: reproduced and fixed on the machine above. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-07 16:32:40 +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#5097
No description provided.