Skip to content

feat: add deterministic synthetic OOM injection hooks - #7

Draft
yjyang62 wants to merge 3 commits into
cursor/pta-oom-2.9.1-fbcafrom
cursor/deterministic-oom-inject-410d
Draft

feat: add deterministic synthetic OOM injection hooks#7
yjyang62 wants to merge 3 commits into
cursor/pta-oom-2.9.1-fbcafrom
cursor/deterministic-oom-inject-410d

Conversation

@yjyang62

@yjyang62 yjyang62 commented Jun 25, 2026

Copy link
Copy Markdown
Owner

【合入来源】

  • 需求
  • 问题单
  • issue/工单
  • 重构优化
  • 资料更新

【修改方案】

  1. 扩展 HCCL OOM 注入:支持 HCCL_OOM_TRIGGER_MODE 一次/持续触发,支持共享 NPU_OOM_TRIGGER_COUNT 作为自动计数触发 fallback,并保留触发文件作为可选调试手段。
  2. 新增 NPU allocator 合成 OOM 注入:支持 NPU_ALLOCATOR_OOM_TRIGGER_COUNT、共享 NPU_OOM_TRIGGER_COUNT、一次/持续模式,按设备默认只触发一次。
  3. 新增 OpCommand 入队/执行前合成 OOM 注入:支持 HCCL_OOM_COUNT、共享 NPU_OOM_TRIGGER_COUNT,覆盖推理稳态无新增大分配、HCCL 计数不命中的路径。
  4. 推荐 PD 推理使用 op 级自动触发:启动环境中配置 HCCL_OOM_COUNT=1NPU_ALLOCATOR_OOM_TRIGGER_COUNT=0HCCL_OOM_TRIGGER_COUNT=0,服务运行中无需 touch 文件或执行额外命令。
  5. 合成故障均抛出 OutOfMemoryError,错误信息包含 NPU out of memory / Failed to allocate memory / Injected ... OOM,不实际占用 HBM,便于 MindIE 快恢恢复。

【资料变更】

涉及。新增并更新 docs/oom_fault_injection.md,说明 PD 推理阶段推荐使用自动计数触发:在 MindIE 启动环境中配置 op 级 OOM 注入,P/D 节点进入推理后由 NPU op 计数自行触发,全 rank/全卡默认各触发一次。

【接口变更】

涉及环境变量级调试/故障注入接口:

  • NPU_OOM_TRIGGER_COUNT
  • NPU_OOM_TRIGGER_MODE
  • NPU_OOM_TRIGGER_FILE(仅作为可选调试手段)
  • NPU_OP_OOM_TRIGGER_FILE
  • NPU_ALLOCATOR_OOM_TRIGGER_FILE
  • HCCL_OOM_TRIGGER_FILE
  • HCCL_OOM_COUNT
  • NPU_ALLOCATOR_OOM_TRIGGER_COUNT
  • NPU_OP_OOM_TRIGGER_MODE
  • NPU_ALLOCATOR_OOM_TRIGGER_MODE
  • HCCL_OOM_TRIGGER_MODE

【功能验证】

  • git diff --check
  • python3 -m py_compile test/npu/test_fault_mode.py
    • 仅输出既有 Invalid device ID[\s\S] 字符串的 SyntaxWarning,与本次新增代码无关。
  • 新增 test_synthetic_allocator_oom_injecttest_synthetic_shared_oom_count_inject 看护合成 OOM 自动计数注入入口。

【CheckList】

  • 代码注释完备,正确记录错误日志
  • 代码实现进行了返回值、空指针等校验
  • PR标题正确使用类型标签,如:feat、fix、refactor、docs、test等
  • PR持续集成流水线(CI)执行通过,代码检查无异常
Open in Web Open in Cursor 

cursoragent and others added 3 commits June 25, 2026 00:23
Co-authored-by: yjyang62 <yjyang62@users.noreply.github.com>
Co-authored-by: yjyang62 <yjyang62@users.noreply.github.com>
Co-authored-by: yjyang62 <yjyang62@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants