evolution-knowledge

Provides domain knowledge for AscendC kernel optimization on Ascend 910B hardware.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Optimizing AscendC kernels for Ascend NPU hardware requires deep knowledge of hardware architecture, API pitfalls, and proven optimization patterns that is scattered and hard to recall during iterative kernel evolution workflows. ## Core Features & Use Cases - Hardware Architecture Reference: Documents Ascend 910B specifics including UB size, core counts, pipeline models, DMA efficiency thresholds, and Roofline analysis for bottleneck diagnosis. - Optimization Pattern Library: Provides code templates with measured impact ranges for double buffering, tiling strategies, causal block skipping, pipeline overlap, memory coalescing, and scalar-to-vector conversion. - API Pitfall Catalog: Lists the top 15+ common AscendC coding mistakes (alignment violations, EnQue/DeQue mismatches, tail block handling) with symptom-to-fix lookup tables. - Use Case: When an evolution agent needs to optimize a memory-bound reduction kernel, it reads the hardware guide and optimization patterns guide, then applies double buffering and scalar-to-vector conversion patterns with the documented code templates. ## Quick Start Query the knowledge base by reading the guide.md file in the category matching your current optimization stage, such as references/a3/optimization_patterns/guide.md before writing kernel code.

Frequently Asked Questions about evolution-knowledge

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

FAQPage Schema
How do I optimize an AscendC kernel that is memory-bound?

Start with double buffering to overlap MTE2 data transfer with vector computation, then apply adaptive tiling strategies. The knowledge base provides code templates showing 20-80% typical speedups for memory-bound kernels on Ascend 910B.

What are the most common AscendC API mistakes?

The top pitfalls include 32-byte alignment violations, missing FreeTensor calls causing UB exhaustion, missing PipeBarrier synchronization, wrong Cast rounding modes, and scalar for-loops that bypass the Vector unit entirely.

Which Ascend hardware architecture does this knowledge base cover?

It currently covers the A3 architecture, specifically Ascend 910B, with details on UB size, AIC/AIV core counts, HBM bandwidth, and pipeline models. Hardware parameters should be verified against runtime detection rather than hardcoded values.

How do I diagnose kernel bottlenecks from msprof profiling output?

Read the profiling_reference category, which maps PipeUtilization, Memory, and L2Cache CSV fields to 18 standardized bottleneck labels like mte2_stall, bank_conflict, and compute_bound, with threshold criteria for each.

When should scalar loops be replaced with vector APIs in AscendC?

Replace scalar reduction loops with ReduceSum when the reduction dimension has 64 or more elements, and replace element-wise loops with Adds/Muls chains when there are at least 3 operations. This conversion has shown 2-11x geomean speedups.