mirror of
https://github.com/kvcache-ai/ktransformers.git
synced 2026-10-17 05:11:19 +08:00
156016c4ef
* fix(kt-kernel): size per-NUMA thread counters by physical NUMA id WorkerPool::init() and NumaJobDistributor::init() indexed the per-NUMA worker counter by the *physical* NUMA ID while sizing it by the number of subpools. A subpool mapped to a NUMA node whose ID is >= the subpool count (e.g. --kt-threadpool-count 1 --kt-numa-nodes 1) therefore read and wrote out of bounds, shifting the per-node core offset and logging "Core ... not found" (or corrupting the heap and aborting). Size the counter vector to cover every NUMA ID present in the subpool map. Add a CPU regression test that builds two subpools on a high-numbered NUMA node and verifies the worker thread offsets. * test(kt-kernel): add single-subpool regression case for #2221 The existing fixture always builds two subpools, so on a dual-socket host (NUMA IDs [0, 1]) the two-element counter stays in bounds and the old code passes there. Add a single subpool mapped to a nonzero NUMA node: the size-1 counter is then indexed at an ID >= 1, reproducing #2221 on any multi-NUMA host. Verified that this case fails/aborts on the unpatched code and passes with the fix. Suggested by @f-wunderlich in review.