一键导入
ascendc-crash-debug
AscendC direct-invoke 崩溃/挂起修复索引:Kernel timeout、hang、Segmentation Fault、aic error、buffer 死锁、plog/memcheck 调试。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
AscendC direct-invoke 崩溃/挂起修复索引:Kernel timeout、hang、Segmentation Fault、aic error、buffer 死锁、plog/memcheck 调试。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
AscendC direct-invoke 精度失败修复索引:输出全 0/随机值、DataCopy 对齐、EnQue/DeQue 同步、FP16/FP32 精度、Cast RoundMode、DumpTensor 分段定位。
AscendC direct-invoke 工程契约:WA 使用 kernel.py + ascendc_op/,ModelNew 调用 torch.ops.npu.*,adapter 负责复制工程、CMake 构建和 npu-arch patch。适用于 dsl=ascendc 的 autoresearch 任务。
把注册式 AscendC 算子迁移为 direct-invoke 工程的保真原则:kernel 算法和 tiling 公式不乱改,只替换注册框架胶水、入口 ABI、host launch 与 PyTorch extension。
CATLASS TileShape 与 on-chip 缓存容量约束:L1/L0A/L0B/L0C 预算公式、fp16/fp32 Pingpong 双缓冲、512B 对齐与排布对 Tile 选型的影响。调参前必读。
CATLASS Gemm 性能调优:DispatchPolicy、Tile 与分核负载均衡、Swizzle、何时用 padding/Split-K/Preload。面向 AR 修改 catlass_kernel.asc 中的类型别名。
CPU C++ 算子核心概念、标准结构模式、KernelBench 代码规范和内嵌扩展方法
| name | ascendc-crash-debug |
| description | AscendC direct-invoke 崩溃/挂起修复索引:Kernel timeout、hang、Segmentation Fault、aic error、buffer 死锁、plog/memcheck 调试。 |
Use this when WA reports timeout, crash, process abort, aic error, or no result from a direct-invoke AscendC kernel.
| Symptom | Likely Cause | First Check |
|---|---|---|
| CMake configure/build fails | environment, include/lib path, npu arch | ASCEND_HOME_PATH, torch_npu, --npu-arch |
.so missing after build | target name/output path mismatch | CMake shared target and build logs |
| import/load fails | wrong library selected or missing registration | torch.ops.load_library, TORCH_LIBRARY namespace |
| timeout/hang | queue deadlock, bad sync, infinite loop | Alloc/Free and EnQue/DeQue pairing |
| aic error | GM/UB out-of-bounds, misalignment | DataCopy length, block/tail math |
| Segmentation Fault | host pointer misuse, null ptr, bad launch ABI | host bridge and kernel declaration |
| output never returns | cross-core flag mismatch | SetFlag/WaitFlag pairs and core participation |
Before editing kernel math, prove the project is being rebuilt and loaded:
ascendc_op/build.so under build/kernel.py load the intended library by stable file name when possibleExample mismatch:
torch.ops.npu.my_op(...)
requires a C++ registration such as:
TORCH_LIBRARY_FRAGMENT(npu, m) {
m.def("my_op(Tensor x) -> Tensor");
}
Host declaration, generated launcher, and kernel entry must match.
Check:
blockDimAvoid host-side void* to GM_ADDR reinterpret tricks that AscendC compilation
or runtime may reject. Keep the launcher ABI simple and consistent.
AllocTensor has a matching FreeTensor.EnQue has a matching DeQue.TPosition values.WaitFlag has a guaranteed SetFlag for every participating core.SetGlobalBuffer length matches each core's actual accessible span.GetBlockIdx() offset cannot exceed total elements.DataCopy/DataCopyPad length is in the expected unit.For local/manual debugging outside the WA loop:
PRINTF / DumpTensor only around suspected stagesRemove heavy instrumentation before returning to optimization mode.
eval_timeout kills the process, first reduce to one failing shape and
run formal verify only.ModelNew.forward(), focus on import/build/load.kernel.py; WA needs the
original error text.