PyTorch 昇腾 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。
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.
None: SKILL.md is the whole skill.
本 skill 处理「模型还没真正跑一步」就崩溃的场景:
torch.compile触发后到 ACL graph capture 完成前的所有报错。 由torch-npugraph-ex-dfx-triage路由进入;如果尚未做首轮日志收集,先回到 triage skill 完成采集再进入本 skill。
torch._dynamo 追踪报错、Unsupported、graph breakBackendCompilerFailed、AOTAutograd / Functorch 栈帧报错npugraph_ex backend 编图层报错(npu_fx_compiler、Meta 推导失败、FakeTensor 类型 / shape 错误)不属于本 skill 的场景:capture 已成功、replay 时 kernel / 通信 / 内存等运行时报错 → 转 torch-npugraph-ex-runtime-error-diagnosis。
看 compile-error 相关日志时,优先锚定首个致因报错,不要被最后统一抛出的包装异常带偏。
torch._dynamo / BackendCompilerFailed / Unsupported / Meta / capture 相关致因报错torch-npugraph-ex-dfx-triage 已默认收集全量日志;本节不是继续堆更多日志开关,而是在证据不足时补充更贴近 npugraph_ex 编图链路的 DFX 工具:
torch-npugraph-ex-knowledge 中的 docs/zh/npugraph_ex/dfx/dfx.md,确认当前可用的 DFX 能力与采集入口。docs/zh/npugraph_ex/dfx/debug_save.md 保存编图 / ACL graph capture 相关的 debug 产物,优先拿这些直接证据做归因。docs/zh/npugraph_ex/dfx/data_dump.md;它不是 compile-error 场景的默认首选。TORCH_LOGS=+dynamo,+aot,+graph_breaks 或 TORCH_LOGS=+allTORCH_COMPILE_DEBUG=1(dump FX graph、AOT graph)torch_npu / NPU API 层问题(脱离图模式范畴,先修 Eager)backend="aot_eager" 失败 → 归类到 Dynamo / FX / AOTAutograd 层问题aot_eager 成功但 npugraph_ex 失败 → 归类到 npugraph_ex backend / Meta 推导 / ACL graph capture 层问题采用「就近定位优先,三仓兜底」的规则,不按固定仓库顺序机械检索。
site-packages/torchair/、site-packages/torch_npu/、site-packages/torch/。| 仓库 | 地址 | 适用阶段 |
|---|---|---|
| upstream PyTorch | https://github.com/pytorch/pytorch.git | torch.compile 前半程语义:Dynamo、FX、AOTAutograd、Functorch、graph break |
| TorchAir | https://gitcode.com/Ascend/torchair.git | npugraph_ex backend、npu_fx_compiler、ACL graph capture、相关 pass |
| Ascend / PyTorch | https://gitcode.com/Ascend/pytorch.git | torch_npu 桥接、Meta / FakeTensor 注册、自定义算子注册 |
本地拉取示例(仅在本地无对应源码时):
git clone --depth 1 --filter=blob:none --sparse https://github.com/pytorch/pytorch.git ~/.cache/pytorch-src
cd ~/.cache/pytorch-src && git sparse-checkout set torch/_dynamo torch/fx torch/_functorch
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
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
torch._dynamo / torch.fx / FakeTensor / AOTAutograd 报错 → 优先 upstream PyTorchnpugraph_ex pass、npu_fx_compiler、ACL graph capture 失败 → 优先 TorchAirtorch_npu 桥接异常 → 优先 Ascend / PyTorchtorch-npugraph-ex-knowledge 中的「调试定位 / 入图失败」小节npugraph_ex 文档与样例appendix/cases/graph_failed_cases.md(若仓库中存在)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
/torch-npugraph-ex-skills:torch-npugraph-ex-compile-error-diagnosisfrom torch-npugraph-ex-skills
npx claudepluginhub jieran-zhang/cannbot-skills --plugin torch-npugraph-ex-skills6 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-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-knowledge