AI agent skills for Ascend C
CANNBot repository provides skills for AI agents with specialized knowledge about Ascend C API, NPU architecture, Tiling design, and Matmul/GEMM optimization. These skills give the AI coding assistant context-aware help with operator development, API usage, and explaining Ascend C specifics. The following instructions are recommended to use with OpenCode client.
Recommended Skills
Skill |
Purpose |
|---|---|
|
Comprehensive reference for all Ascend C API categories: arithmetic, reduction, sort, DataCopy, Transpose, Buffer management, precision conversion, pipeline operations, and API restrictions |
|
Matmul/Cube/GEMM/BMM development via Blaze/tensor_api path. Covers AIC/StreamK/FixpOpti modes, dispatch modes, Tiling strategies, and workspace configuration |
|
Code review pipeline for Ascend C: file review, PR review, large PR handling, design consistency checks. Includes 11 reference rule sets covering API usage, performance, security, SIMT constraints, and C++ coding standards |
|
Debugging methodology for hang/crash/deadlock scenarios: symptom-to-cause mapping, Buffer deadlock diagnosis, cross-core sync issues, memory error detection via mssanitizer. Includes crash workflows and memcheck references |
|
Local search across API documents and code examples from |
|
Performance optimization patterns by operator family: MatMul, RadixSort, Scalar, Reduction, Elementwise. Covers pingpong, swap, streamk, fullload, and 8 optimization rules |
|
4-step performance optimization strategy: Tiling modeling → inter-card pipeline → inter-core pipeline → intra-core pipeline. Bound diagnosis (compute/memory/communication) with Tiling parameter refinement. Self-contained tiling models for all operator categories |
|
Systematic precision issue diagnosis: pipeline sync (EnQue/DeQue), DataCopy alignment, Cast RoundMode, FP16/BF16 cross-validation, DumpTensor 7-step method. Includes error analysis scripts and boundary test generation |
|
Runtime error debugging: comprehensive error code reference (161xxx/361xxx/561xxx), kernel binary debugging (compilation, cache, SEL matching, opParaSize), plog analysis. Includes debug workflows and error code tables |
|
Tiling methodology for all operator categories: Reduction, Sort, Elementwise, Broadcast, MatMul, Conv. Covers UB budgeting, Buffer strategies, and chunk sizing |
|
NPU architecture knowledge: DAV_2201 vs DAV_3510, buffer sizes (UB/L0C/BT), Cube/Vector/MTE units, SIMD vs SIMD-RegBase, NDDMA, CCU |
|
DAV_3510 RegBase (SIMD-RegBase) development: API constraints, implementation
structure, common pitfalls, and real reference operators for the
|
|
Ascend C signal synchronization verification and fix: detects missing/mismatched
sync between pipelines (MTE2/MTE3/Vector/Cube) and across cores
(CrossCoreSetFlag/SyncAll), flag reuse conflicts, and buffer-index
inconsistencies that cause hangs, deadlocks, or half-finished data; ships
static analyzers ( |
|
On-board performance collection and analysis via |
|
CANN Simulator ( |
|
|
|
Operator precision standards (mixed tolerance atol/rtol) per dtype and operator category: random / non-compute / integer / quantization / float; used for ST verification and FP16/BF16/FP32 acceptance criteria |
Directory Structure
The cannbot-skills repository should be cloned as a sibling directory to pyasc (not inside the project).
Skills are symlinked into .opencode/skills/, the ops-code-reviewer agents into .opencode/agents/,
and asc-devkit is symlinked in the project root.
All paths use the $CANNBOT_SKILLS environment variable.
Installation
# Clone cannbot-skills as sibling to pyasc
export CANNBOT_SKILLS=$PWD/../cannbot-skills
git clone https://gitcode.com/cann/cannbot-skills.git $CANNBOT_SKILLS
# Clone asc-devkit (API docs + examples)
git clone https://gitcode.com/cann/asc-devkit.git $CANNBOT_SKILLS/plugins-official/ops-direct-invoke/asc-devkit
# Create symlinks
skills=(
ascendc-api-best-practices
ascendc-blaze-best-practice
ascendc-code-review
ascendc-crash-debug
ascendc-docs-search
ascendc-performance-best-practices
ascendc-perf-optimize
ascendc-precision-debug
ascendc-runtime-debug
ascendc-tiling-design
npu-arch
ascendc-regbase-best-practice
ascendc-sync-audit
ops-profiling
ops-simulator
aiss-tiling-solver
ops-precision-standard
)
for skill in "${skills[@]}"; do
ln -sfn $CANNBOT_SKILLS/ops/$skill .opencode/skills/$skill
done
ln -sfn $CANNBOT_SKILLS/plugins-official/ops-direct-invoke/asc-devkit ./asc-devkit
# ops-code-reviewer plugin: agent symlinks only (do not overwrite AGENTS.md)
mkdir -p .opencode/agents
for agent in ascendc-code-summarizer ascendc-ops-reviewer; do
ln -sfn $CANNBOT_SKILLS/plugins-official/ops-code-reviewer/agents/$agent.md .opencode/agents/$agent.md
done
# Verify skills installation
for s in .opencode/skills/*/; do
[ -f "$s/SKILL.md" ] && echo "OK: $s" || echo "MISSING: $s"
done
Restart OpenCode to load the skills.
Hiding Symlinks from Git
The symlinks created above (asc-devkit, skills under .opencode/skills/, and agents under
.opencode/agents/) are external dependencies and should not be tracked by git. It is recommended
to add them to the local .git/info/exclude file:
echo "
# CANNBot skills symlinks
asc-devkit
.opencode/skills/ascendc-*
.opencode/skills/npu-arch
.opencode/skills/ops-*
.opencode/skills/aiss-*
.opencode/agents/ascendc-*" >> .git/info/exclude
Updating
cd $CANNBOT_SKILLS && git pull
cd plugins-official/ops-direct-invoke/asc-devkit && git pull
Restart OpenCode to apply updates.
Alternative: Automated Installation
Use init.sh from a plugin directory to install all skills from that plugin:
cd $CANNBOT_SKILLS/plugins-official/<plugin-name>
bash init.sh project opencode /path/to/pyasc
See the cannbot-skills README for available plugins.