cake-evo

Orchestrates parallel evolutionary generation and selection of optimized AscendC NPU kernels.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

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

What problem does it solve? Writing high-performance AscendC kernels for Ascend NPUs requires exploring many optimization strategies, and a single attempt rarely finds the best implementation. This Skill automates multi-round evolutionary optimization by spawning parallel kernel variants with different strategies, evaluating each on real NPU hardware, and selecting the fastest correct implementation. ## Core Features & Use Cases - Two Starting Modes: Begin from a natural-language operator description (generating op description, PyTorch reference, functional API, and CMake project) or from an existing baseline AscendC kernel whose interface is preserved while internals are optimized. - Parallel Evolution Rounds: Launches multiple cake-partial subagents in the same message per round, each applying strategy patterns (double buffering, adaptive tiling, FP32 intermediate computation, etc.) drawn from a strategy index distilled from 43 production operators. - Automated Evaluation and Selection: Compiles, installs, and benchmarks every variant via the eval_op.sh pipeline, classifies results into good/medium/poor tiers by speedup, feeds top implementations back as inspiration for the next round, and stops when the target speedup or max rounds is reached. - Use Case: Given a BatchMatmulMaxSum operator spec, run 2 rounds with 3 parallel variants each to evolve a fused Cube+Vector kernel that beats the baseline by the target speedup, with full per-round reports saved under the output directory. ## Quick Start Ask the assistant to evolve an optimized AscendC kernel for your operator, providing either a natural-language operator description or the path to an existing baseline kernel project, plus the desired max rounds, parallel count, and target speedup.

Frequently Asked Questions about cake-evo

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

FAQPage Schema
How do I optimize an AscendC kernel with evolutionary parallel variants?

Provide either a natural-language operator description or a path to an existing baseline kernel project, then set max rounds, parallel variant count, and target speedup. The skill generates shared files once, launches parallel cake-partial subagents per round, evaluates each variant, and feeds the best implementations into the next round.

What is the difference between description mode and baseline kernel mode?

Description mode generates everything from scratch: op description, PyTorch reference, functional API, and CMake project. Baseline mode starts from an existing AscendC kernel, first benchmarks it as a reference, then optimizes only the kernel internals while strictly preserving the operator's input/output/parameter interface.

Does this skill require an Ascend NPU environment?

Yes. It auto-detects the environment by checking for npu-smi and the ASCEND_HOME_PATH variable. Without a configured CANN environment, local compilation and on-device evaluation of kernel variants cannot run.

How are kernel variants evaluated and selected each round?

Each variant is compiled, installed, and benchmarked via the eval_op.sh pipeline, producing an evaluation_results.json with compilation success, precision, and speedup. Variants are classified into good, medium, and poor tiers by speedup, and top implementations become inspiration for the next round.

When does the evolutionary optimization loop stop?

The loop terminates when the target speedup is reached, when no variant compiles and passes precision successfully, or when the configured maximum number of rounds is exhausted. The final output reports the top implementations and the path to the best one.