feat: inject HCCL OOM after warmup - #2
Draft
yjyang62 wants to merge 6 commits into
Draft
Conversation
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
【合入来源】
【修改方案】
ProcessGroupHCCL.cpp中新增 HCCL OOM 故障注入计数器,默认在非 ACLGraph capture 状态下按 HCCL API 调用次数触发。HCCL_CHECK_ERROR后再注入,使故障更接近真实 HCCL API 调用边界后的 OOM 上报;P2P coalescing 场景会先执行hcclGroupEnd,避免人为留下未闭合 group。TORCH_CHECK_WITH(OutOfMemoryError, false, retmsg.c_str());,错误文本包含Failed to allocate memory和HCCL_E_OOM错误码。支持通过HCCL_OOM_TRIGGER_COUNT调整触发阈值,设置为小于等于 0 可关闭该注入。torch_npu/csrc/aten/NPUNativeFunctions.h未生成导致CopyFromAndResizeKernelNpu.cpp编译失败的问题:当 CMake 配置阶段发现生成头不存在时,调用现有generate_code.sh生成 ATen binding 文件,再继续收集/编译源文件。malloc的无差别计数,改为普通 tensorallocate路径上的候选分配计数,触发前不进入真实 allocator 分配流程,降低影响面并便于上层恢复。PTA_OOM_ENABLE=1;开启后默认所有 rank、所有 device 都可触发;默认只统计非 graph capture、size >= 64MiB 的普通 tensor 分配,并且只触发一次。可通过PTA_OOM_RANK或PTA_OOM_DEVICE显式收窄到单 rank/单卡。PTA_OOM_ENABLE显式开启注入,PTA_OOM_TRIGGER_COUNT控制候选分配计数阈值,PTA_OOM_MIN_ALLOC_BYTES控制最小分配大小,PTA_OOM_MAX_ALLOC_BYTES控制最大分配大小,PTA_OOM_RANK限定 rank,PTA_OOM_DEVICE限定 NPU device。【资料变更】
不涉及
【接口变更】
不涉及正式接口变更;新增仅用于故障注入分支的环境变量
HCCL_OOM_TRIGGER_COUNT、PTA_OOM_ENABLE、PTA_OOM_TRIGGER_COUNT、PTA_OOM_MIN_ALLOC_BYTES、PTA_OOM_MAX_ALLOC_BYTES、PTA_OOM_RANK、PTA_OOM_DEVICE。【功能验证】
git diff --check,无空白格式问题。git diff --check HEAD~1..HEAD验证最新 PTA OOM 默认全 rank 触发调整提交。torch模块以及 C++ 链接所需libstdc++,配置在编译器自检阶段失败,未能运行完整 CMake 构建。【CheckList】