ascendc-crash-debug

Diagnose Ascend C operator hangs, crashes, and memory errors on NPU hardware.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill ascendc-crash-debug-wangwindow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: ascendc-crash-debug
Source: https://github.com/WangWindow/CANN-BatchMatMulMaxsum/tree/main/.agents/skills/ascendc-crash-debug
Command: npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill ascendc-crash-debug-wangwindow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? Ascend C operators running on Ascend NPU hardware can hang without response, crash with Segmentation Fault or Abort, or fail intermittently due to memory corruption, and these failures are hard to localize without a systematic debugging workflow. ## Core Features & Use Cases - Symptom-based routing: A decision tree and symptom-cause table route hangs, timeouts, crashes, deadlocks, and aic errors to the right debugging workflow. - Coredump and plog analysis: Guides GDB backtrace analysis of core files and includes a parse_plog.py script that extracts timeout, crash, and hardware exception signals from Ascend plog logs. - Proactive memory error detection: Automates mssanitizer memcheck via run_memcheck_pre.sh and a JSON config template to detect illegal read/write, multi-core overwrite, misaligned access, illegal free, memory leaks, and unused memory. - Use Case: Your operator occasionally crashes with an unclear coredump stack and aic error in the logs; the skill walks you through compiling with sanitizer options, running memcheck, and interpreting the ERROR/WARNING report to locate the out-of-bounds access. ## Quick Start Ask the assistant to load the ascendc-crash-debug skill and diagnose why your Ascend C operator hangs or crashes on the NPU.

Frequently Asked Questions about ascendc-crash-debug

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug an Ascend C operator that hangs or times out?

Start by parsing the plog log to locate the hang position, then check AllocTensor/FreeTensor pairing and EnQue/DeQue queue synchronization. For deeper inspection use AscendC::PRINTF, DumpTensor, or msDebug single-step debugging inside the kernel.

How to analyze a Segmentation Fault in an Ascend C operator?

Enable coredump with ulimit -c unlimited, rerun the program to generate a core file, then analyze it with gdb using bt and bt full to inspect the call stack. Common causes are null pointer dereference and out-of-bounds memory access.

What memory errors can mssanitizer memcheck detect on Ascend NPU?

mssanitizer memcheck detects six exception types: illegal read/write, multi-core overwrite, misaligned access, illegal free, memory leak (with --leak-check=yes), and unused allocated memory (with --check-unused-memory=yes).

Why does my Ascend C operator report aic error?

aic error usually indicates out-of-bounds memory access or misaligned access. Check DataCopy lengths, GM address offset calculations, UB buffer bounds, and 32-byte alignment; for complex code, run mssanitizer memcheck to locate the fault.

How do I run automated memory detection for an Ascend C operator?

Copy memcheck_input.json.template, fill in operator name, code path, test script, device type, and CANN environment, then execute run_memcheck_pre.sh. It compiles with sanitizer options, installs the operator package, and runs mssanitizer memcheck automatically.

What causes AIV core hangs and drain stalls in multi-core Ascend C kernels?

AIV hangs typically result from missing cross-core synchronization, such as a CrossCoreWaitFlag without a matching SetFlag. Drain stalls usually mean the AIV-to-AIC flag was never sent, so verify the complete flag sending chain.