Diagnoses runtime errors in PyTorch Ascend NPU npugraph_ex after successful graph capture, covering ACL/HCCL/stream/event/OOM/segfault issues.
Ships in torch-npugraph-ex-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
本 skill 处理「模型已在执行」阶段的崩溃:ACL graph capture 已成功、replay 后才出现的报错。 由
torch-npugraph-ex-dfx-triage路由进入;如果尚未做首轮日志收集,先回到 triage skill 完成采集再进入本 skill。
aclnnXxx 算子执行失败、ACL runtime 报错、acl errorhccl error、ranktable、ring 异常)stream / event 同步错误、跨流依赖丢失device side assert、segfault、kernel illegal memory access不属于本 skill 的场景:编译期 / capture 期就报错 → 转 torch-npugraph-ex-compile-error-diagnosis。
边界情况:capture 阶段无报错、replay 算子才 fail,默认归本 skill;若证据不足以判定,可同时参考 compile-error skill 的 Meta / capture 部分。
看 runtime-error 相关日志时,优先锚定首个致因报错,不要被后续 task fail、stream 同步失败、graph replay 失败等次生报错带偏。
aclnnXxx / OOM / stream-event 相关致因报错在已收集的全量日志基础上,若证据不足,可补充打开:
ASCEND_GLOBAL_LOG_LEVEL=1(INFO)或 =0(DEBUG,谨慎)ASCEND_SLOG_PRINT_TO_STDOUT=1HCCL_LOGIC_SUPERPOD_ID、HCCL_BUFFSIZE、HCCL_EXEC_TIMEOUT 等通信相关变量按需~/ascend/log/),定位时间戳与崩溃栈对齐aclnn / aclop → 算子层(kernel / tiling / shape)HCCL / hccl → 通信层(ranktable、链路、buffer)stream / event / synchronize → 流 / 事件 / 同步层OOM / out of memory / allocate → 内存层segfault / device side assert / illegal memory access → 先看是否落在算子层,再看是否为 host 侧指针 / 索引越界torch_npu 中具体文件 / 函数(如 stream / event / NPU API),先读取该上下文附近源码。runtime-error 的定位策略不同于 compile-error:优先看本地 CANN 安装产物、plog、错误码、算子规格和 HCCL/ACL 运行时线索;torch_npu / TorchAir 仓库源码只用于补桥接层证据,不作为第一入口。
aclnnXxx / aclrt)时,先围绕这些直接证据定位,不要先泛读仓库源码。$ASCEND_HOME_PATH 或 /usr/local/Ascend/)下可直接支撑归因的内容,例如:
.so、符号名、版本信息、依赖关系site-packages/torch_npu/、site-packages/torchair/。| 仓库 | 地址 | 适用阶段 |
|---|---|---|
| Ascend/pytorch | https://gitcode.com/Ascend/pytorch.git | torch_npu runtime、NPU API、stream / event、多流、内存分配器、自定义算子桥接 |
| TorchAir | https://gitcode.com/Ascend/torchair.git | npugraph_ex replay 链路、capture 后执行入口、replace_stream_event 等 pass |
| upstream PyTorch | https://github.com/pytorch/pytorch.git | torch.cuda 风格的 stream / event 抽象(仅作为 torch_npu 桥接对照) |
若本地安装的 CANN 不包含可读源码,不要假设一定能看到“CANN 内部实现”;优先依赖 plog、错误码、算子规格、头文件、符号和版本信息做归因。
本地拉取示例(仅在本地日志 / 安装产物不足,且确需看桥接层源码时):
git clone --depth 1 --filter=blob:none --sparse -b v2.7.1 https://gitcode.com/Ascend/pytorch.git ~/.cache/torch-src
cd ~/.cache/torch-src && git sparse-checkout set torch_npu docs/zh
git clone --depth 1 --filter=blob:none --sparse https://gitcode.com/Ascend/torchair.git ~/.cache/torchair-src
cd ~/.cache/torchair-src && git sparse-checkout set npugraph_ex docs/zh
torch_npu 算子桥接torch_npu stream/event 实现与 TorchAir replace_stream_eventtorch_npu allocator 与 PYTORCH_NPU_ALLOC_CONFtorch-npugraph-ex-knowledge 中「调试定位 / 运行时报错」小节appendix/cases/runtime_cases.md(若仓库中存在)What SKILL.md sets; muted values are Claude Code's defaults
/torch-npugraph-ex-skills:torch-npugraph-ex-runtime-error-diagnosisfrom torch-npugraph-ex-skills
npx claudepluginhub hicann/cannbot-skills --plugin torch-npugraph-ex-skills7 skills in this plugin
/torch-custom-ops-guide自定义算子入图完整指南。覆盖从零开发、Eager 算子适配 npugraph_ex 图模式(torch.library.custom_op / torch.library.Library)、Meta 推导函数编写等全流程。适用于两种纯 Python 自定义算子注册场景。关键词:custom_op、torch.library.Library、register_fake、meta、mutates_args。/torch-npugraph-ex-compile-error-diagnosisPyTorch 昇腾 NPU npugraph_ex 编译期报错诊断。覆盖 torch.compile 触发后 TorchDynamo / FX / AOTAutograd / npugraph_ex backend / ACL graph capture 阶段的报错排查,包括 Unsupported / graph break / BackendCompilerFailed / Meta 推导失败 / capture 失败等场景。本 skill 由 dfx-triage 路由进入。触发:当用户遇到 npugraph_ex 入图失败、graph break、BackendCompilerFailed、Meta 推导失败或 capture 失败时加载。关键词:入图失败、断图、graph break、BackendCompilerFailed、Meta、FakeTensor、aot_eager、capture。/torch-npugraph-ex-dfx-triagePyTorch 昇腾 NPU npugraph_ex DFX 问题分诊入口。统一执行首轮全量日志收集与最少闭环信息核对,按报错栈和现象将问题路由到 compile-error / runtime-error / accuracy / performance 四个专科 sub-skill。本 skill 不输出最终诊断结论,只完成「采集 + 分类 + 加载下游 skill」。触发:当用户报告 npugraph_ex 相关报错、断图、精度差异或性能回退、需要 debug/dump 定位时加载。关键词:问题定位、报错、断图、精度、性能、debug、dump、aot_eager。/torch-npugraph-ex-knowledgenpugraph_ex(aclgraph)模式使用指南。采用 Capture & Replay 方式将算子任务下沉至 Device 执行,减少 Host 调度开销,适用于固定 shape 在线推理低延迟场景。涵盖模式配置、FX Pass、编译缓存、多流并行、内存复用、静态 Kernel 编译、限核、性能优化、调试定位、自定义算子入图等。关键词:npugraph_ex、aclgraph、backend="npugraph_ex"、capture、replay、reduce-overhead、config.aclgraph_config。/torch-npugraph-ex-performance-diagnosisPyTorch 昇腾 NPU npugraph_ex 性能诊断(FX 图静态审计,聚焦冗余 tensor move 与疑似 reinplace 未命中)。处理「5 step 全部通过、但推理慢/Device 利用率低」阶段:基于 TORCH_COMPILE_DEBUG=1 产出的 FX 图序列与 debug.log,定位 reinplace_inplaceable_ops_pass(out-of-place→in-place)与 reinplace_input_mutated_ops(折叠输入侧 copy_)回填未完成留下的 copy_/clone/out-of-place 冗余,并识别 Compressor 等 Python wrapper 显式 clone/copy_ 经 Functionalize 后伪装成 reinplace 失败的版本型问题。本 skill 由 dfx-triage 路由进入;**不**处理 graph break / recompile / guard failure(归 compile-error-diagnosis)。触发:当用户报告 npugraph_ex 推理慢、性能回退、怀疑图里有多余搬运/拷贝、reinplace 没生效时加载。关键词:性能、慢、tensormove、tensor move、reinplace、functionalize、copy_、clone、auto_functionalized、compressor、remove_noop_ops、multi_stream、can_inplace、missed reinplacing、inplace_pass、input_inplace_pass、clone_input、TORCH_COMPILE_DEBUG。/torch-npugraph-ex-templatenpugraph_ex 模式的 MRE(最小可复现示例)代码模板。包含标准 npugraph_ex 编译模板和 npugraph_ex 编译缓存(cache_compile)模板。触发:当用户需要从零生成 npugraph_ex 模式代码、做概念解释、对比分析或配置指导时加载。2 plugins ship this exact skill · first indexed Oct 20, 2026
Other plugins' skills for the same job