Debug route for Ascend C operator crashes, hangs, deadlocks, and memory errors. Covers coredump analysis, plog review, buffer/sync checking, and memory error detection using mssanitizer.
Ships in ops-direct-invoke-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; scripts run unread.
系统化调试 Ascend C 算子无法运行完的问题,包括程序卡死/挂起、Kernel超时、程序崩溃。
程序无法运行完或偶发崩溃
│
├─ 程序崩溃(Segmentation Fault / Abort)?
│ ├─ 启用 coredump → ulimit -c unlimited
│ ├─ 生成 core 文件 → 运行程序
│ └─ GDB 分析 → gdb <exe> <core> → bt / bt full / info locals
│
├─ 程序卡死/超时?
│ ├─ 查看 plog 日志 → 定位卡死位置
│ ├─ 检查 Buffer 配对 → AllocTensor/FreeTensor
│ ├─ 检查同步 → EnQue/DeQue 配对
│ └─ Kernel 调试 → AscendC::PRINTF / DumpTensor / msDebug
│
├─ 日志包含 AIC/AIV Error、EXCP DS、ERR_INFO 或异常 PC?
│ ├─ 先保留同一次故障的 kernelName、core type 和完整寄存器;TilingKey 已知时记录
│ └─ 需要定位具体指令 → npu-objdump-toolkit 异常 PC 精确反汇编
│
└─ 偶发崩溃/怀疑内存错误导致异常?
└─ 内存错误主动检测 → mssanitizer
├─ 越界读写(Illegal Read/Write)
├─ 多核踩踏(Multi-core Overwrite)
├─ 非对齐访问(Misaligned Access)
└─ 内存泄漏(Memory Leak)
| 症状 | 可能原因 | 诊断方向 |
|---|---|---|
| 程序卡死/超时 | Buffer 未释放 / 死锁 | 检查 AllocTensor/FreeTensor 配对、EnQue/DeQue 配对 |
| 核心超时/挂起 | Buffer 冲突/死锁 | 检查 Alloc / Free 配对 |
| Segmentation Fault | 空指针解引用 / 内存越界 | GDB 分析 coredump → bt 查看调用栈;如堆栈不清晰 → mssanitizer 内存检测 |
| Abort | 断言失败 / 异常终止 | GDB 分析 coredump → 检查断言条件 |
| 栈溢出 | 递归过深 / 大数组 | 检查 Kernel 内数组大小 |
| aic/aiv error | 内存访问越界 / 非对齐访问 / 非法指令 | 检查 DataCopy 长度、32B 对齐;已有 EXCP DS、ERR_INFO 或异常 PC 且需要具体指令时,使用 npu-objdump-toolkit 的异常 PC 精确反汇编;需要主动检测内存错误时使用 mssanitizer |
| AIV 卡死 | 跨核同步缺失 | 检查 CrossCoreWaitFlag 对应 SetFlag |
| drain 卡死 | 未发送 AIV→AIC flag | 检查 flag 发送链路 |
| 偶发崩溃无法复现 | 内存踩踏 / 竞争条件 | mssanitizer 内存检测(加 -g 编译选项定位) |
| 场景 | 说明 | 详细步骤 |
|---|---|---|
| 程序崩溃 | Segmentation Fault / Abort | Coredump 调试 |
| 程序卡死/超时 | Kernel 无响应、挂起 | Kernel 挂起调试 |
| Buffer 冲突/死锁 | Alloc/Free 不配对、同步缺失 | Buffer 问题排查 |
| 内存错误主动检测 | 越界读写/多核踩踏/非对齐访问/内存泄漏/偶发崩溃 | mssanitizer 内存检测 |
| AIC/AIV 异常指令定位 | 已有 AIC/AIV Error 日志、EXCP DS/ERR_INFO 或异常 PC,需要查看对应指令 | npu-objdump-toolkit 的异常 PC 精确反汇编 |
故障日志、coredump、输入输出和内存报告可能包含业务数据。验证报告只保留定位所需的最小片段、路径、shape 和哈希,不提交原始数据、token、密钥或凭据。
bash -n ops/ascendc-crash-debug/scripts/run_memcheck_pre.sh
python3 -m py_compile ops/ascendc-crash-debug/scripts/parse_plog.py
INCREMENTAL_SKILLS=ascendc-crash-debug bash tests/unit/skills/test-structure.sh
INCREMENTAL_SKILLS=ascendc-crash-debug bash tests/unit/skills/test-content.sh
git diff --check
验证应覆盖 Segmentation Fault、Kernel 卡死、内存踩踏和 AIC/AIV Error 四类路由;其中 AIC/AIV Error 用例需要确认会在已有 ERR_INFO/异常 PC 且用户要求具体指令时进入 npu-objdump-toolkit,普通稳定精度误差和 561xxx Kernel 查找错误不进入该分支。
evals/evals.json (opens in a new tab)references/crash_workflow.md (opens in a new tab)references/memcheck/README.md (opens in a new tab)references/memcheck/automated_workflow.md (opens in a new tab)references/memcheck/mssanitizer_guide.md (opens in a new tab)scripts/memcheck_input.json.template (opens in a new tab)scripts/parse_plog.py (opens in a new tab)scripts/run_memcheck_pre.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
/ops-direct-invoke-skills:ascendc-crash-debugfrom ops-direct-invoke-skills
npx claudepluginhub catman626/cannbot-skills --plugin ops-direct-invoke-skills24 skills in this plugin
/ascendc-api-best-practicesAscend C API 使用最佳实践。提供算术、归约、数据搬运、Buffer管理、精度转换、通信接口等 API 的正确用法和限制说明。触发:用户询问具体 API 用法(如"DataCopy 怎么用"、"ReadNbi 怎么用")、遇到 API 参数错误或限制报错(如 repeatTimes、对齐问题)、需要查看 API 最佳实践或避坑指南时。/ascendc-blaze-best-practice在 Ascend 950 / DAV_3510 平台上,基于 Blaze/tensor_api 开发 Basic、Batch、Grouped、Quantized、MX 等 MatMul 类算子或相关的融合算子时使用。不适用于纯 Vector 算子或 A2/A3 平台。/ascendc-blaze-migration评估并将 ops-nn、ops-transformer 等仓中 Ascend 950 / DAV_3510 的 AscendC Kernel 分支等价迁移到 ops-tensor Blaze/Tensor API。适用于 CMCT、CGMCT、单体或自定义分层 Kernel,以及 Cube、Vector、MIX、高阶 Matmul、手工 Buffer、数据搬运、自定义调度、VF 和同步路径;在隔离迁移工程中串行完成迁移合同冻结、Blaze 开发、验证资产生成、原始基线、Blaze 验收和双仓本地提交交付。/ascendc-code-reviewAscend C 代码检视技能。触发:检视代码、检视 PR、检查是否有问题、快速检视。支持文件检视、PR 检视、快速定向检视、设计一致性检查。自动识别代码侧别、提取适用条例、执行假设检验驱动的逐条检视。/ascendc-direct-invoke-templateKernel直调工程模板,用于创建 Ascend C Kernel 直调工程项目。提供经过验证的 Vector 样例工程(add_custom)、Blaze Matmul 工程模板(纯 Matmul / 融合 / MX 量化 / GroupMatmul)和 Kirin Vector 模板。触发:当用户需要创建 Kernel 直调工程、学习 Ascend C 编程、快速原型验证、或提及"Kernel直调"、"<<<>>>内核调用"、"Blaze Matmul"、"matmul 模板"时使用本 skill。/ascendc-docs-genAscend C 算子文档写作参考。提供需求分析、详细设计、迭代计划、aclnnAPI接口文档、算子README的标准模板。当用户需要生成算子文档、aclnnAPI文档、算子README、参考文档模板或了解算子文档规范时触发此技能。2 plugins ship this exact skill · first indexed Oct 20, 2026
Other plugins' skills for the same job