fix: leave the NUMA split plan clean when the split is refused

This commit is contained in:
Baptiste Rajaut authored and Niko1221 committed 2026-10-20 10:22:05 +02:00
1 parent c4442fed95
commit ec841ca1e9
2 files changed
+7 -1

No files matched your search

+5
View File
@@ -741,6 +741,11 @@ ExpertPool::ExpertPool(int n_workers, bool pin, bool host_works, PoolAffinity af
}
plan.why = why;
plan.on = plan.why.empty();
if (!plan.on) { // a refusal after the slices were planned (unbalanced) leaves no half-filled plan behind
plan.nodes[0] = plan.nodes[1] = -1;
plan.cores[0].clear();
plan.cores[1].clear();
}
if (plan.on) {
numa_n_ = 2;
nsync_.reset(new NodeSync[2]);
+2 -1
View File
@@ -234,7 +234,8 @@ int main(int argc, char** argv) {
cpu::ExpertPool pool(4, true, true);
const auto& plan = cpu::active_numa_split();
ok = plan.on ? plan.nodes[0] != plan.nodes[1] && !plan.cores[0].empty() && !plan.cores[1].empty()
: !plan.why.empty();
: !plan.why.empty() && plan.nodes[0] == -1 && plan.nodes[1] == -1 && plan.cores[0].empty() &&
plan.cores[1].empty();
std::printf("pool tasks: real split %s%s\n", plan.on ? "on" : "off: ", plan.why.c_str());
}
unset_env("STRATA_NUMA_SPLIT");