Skip to content

kali20gakki/msAgent / skills/host-cpu/msagent-perf-cpu-bind-tune

msagent-perf-cpu-bind-tune

Flagged

昇腾 NPU 多卡任务的 Host CPU 绑核方案求解器:覆盖 PyTorch 训练/离线推理与 vLLM-Ascend、SGLang 推理服务的 rank/worker/engine 分核,基于 NUMA 拓扑与 卡↔进程映射输出可执行、可回滚、可验证的绑核计划(taskset 前缀 / cpuset / OMP 环境变量),自动判定事前(env 片段)与事中(在线 sched_setaffinity)双形态。 触发:绑核方案、核怎么分、per-rank 绑核、NUMA 绑定方案、cpuset 划分、多卡分核、 CPU range 冲突、TTFT 或吞吐受 CPU 影响。 不用于:绑核没生效/绑核异常诊断(→ perf-cpu-config-audit);运行期是否落核 (→ perf-cpu-tracing);变慢根因归因(→ perf-cpu-perf-triage)。

references/checks.md

View on GitHub
# 可行性检查 C1-C5

| 检查 | 判据 | 处理 | 实现状态 |
| --- | --- | --- | --- |
| C1 核预算不足 | unit 可用核 < 3(comm 1 + io 1 + compute 1) | 写入 `unresolved` | 已实现(`feasibility.check`) |
| C2 L3 跨域 | unit 核集不落在同一 L3 domain | `l3_split=true` 告警 | 已实现(`feasibility.check`) |
| C3 unit 核集冲突 | 两个 unit 的 cpuset 相交 | 写入 `unresolved` | 已实现(`feasibility.check`) |
| C4 SMT | 检测到 SMT 且策略为 exclusive | `smt_shared=true` 提示 | 已实现(`feasibility.check`) |
| C5 容量回退 | plan 核数 < 当前亲和核数 | 标 `capacity_gap`;local-first 不静默跨 node | 已实现(`feasibility.check`) |

## 降级链(确定性)

```text
D1 启用 SMT 兄弟(无 SMT 时跳过)
D2 逻辑线程共享(oversubscribed=true,明确不推荐)
D3 跨 node(cross_numa=true,取拓扑距离最近的 node)
D4 仍不足 -> unresolved(check=C1)
```

> 实现状态:D1-D4 降级链**本期未实现**,当前只做 C1-C5 判定并输出告警/`unresolved`,
> 不做自动降级决策;后续版本按上表顺序补齐。

## local-first 原则

- 优先把 unit 放到 NPU 所在 node;
- 同一 node 多个 NPU/unit 时均分业务核;
- 若均分后核数少于当前亲和,保留 `capacity_gap` 告警,不自动扩到跨 node;
- 需要保留 CPU 容量时,由用户显式选择后续 `capacity` 策略(本期未实现)。
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall