Organizations: School of Computer Science and Technology, East China Normal University · School of Computer Science and Technology, Tongji University · Shanghai University of International Business and Economics · Key Lab of Mathematics and Engineering Applications (MoE), East China Normal University · School of Mathematical Sciences, East China Normal University · Shenzhen Loop Area Institute (SLAI)
Optimizing AscendC (Ascend C) operators for Ascend NPUs is difficult for two reasons. First, unlike CUDA, the ecosystem offers few public kernels to learn from. Second, performance depends on a coupled two-part implementation: a host-side tiling program that controls data movement and a kernel program that schedules and pipelines computation. We present AscendOptimizer, an episodic agent that builds missing optimization knowledge from execution itself. For kernel optimization, AscendOptimizer rewinds strong implementations by removing optimizations in a controlled way, then keeps the changes whose removal measurably hurts performance as reusable experience for later rewriting. For host-side optimization, it runs profiling-in-the-loop evolutionary search to find valid, fast tiling and data-movement configurations directly from hardware feedback. This combination lets the agent improve kernel structure and host-side scheduling together. On a benchmark of 101 real AscendC operators, AscendOptimizer achieves a 1.21x geometric-mean speedup over the open-source baseline, and 53.47% of operators run faster than their references. Given a same budget of evaluations per operator, AscendOptimizer consistently outperforms Best-of-N sampling and OpenEvolve in terms of geometric mean speedup, fast_p tail speedup ratios, and overall optimization progress across varying budgets.
Figures & tables
Model
CUDA (Pass@1)
AscendC (Pass@1)
DeepSeek-R1
52.6%
1.4%
Claude-Sonnet-4
47.0%
2.1%
Qwen3-235B (think)
44.2%
0.7%
Table 1: One-shot operator generation pass rate (Pass@1) across hardware platforms, reported by MultiKernelBench [ 37 ] . The results confirm severe knowledge scarcity on Ascend.
Figure 1: Overview of AscendOptimizer . Offline, we rewind benchmark operators and distill validated optimization motifs into a shared experience bank. Online, the bank guides Stage I kernel refinement, after which Stage II searches host-side tiling configurations under the refined kernel.
Table 2: Main performance. GM is geometric-mean speedup over cann-ops ; fast p is the fraction of operators exceeding p× speedup.
Figure 2: Optimization progress under hardware-evaluation budget. AscendOptimizer remains ahead of Best-of- N sampling and OpenEvolve across the evaluated budgets.
Variant
Enabled components
Performance
Rewrite
Experience
Tiling
GM ↑
>1.2↑
>1.4↑
>1.8↑
>2.0↑
Stage I only
✓
✓
✗
1.16
18.81%
12.87%
9.90%
7.92%
Stage I w/o Experience
✓
✗
✗
1.09
12.62%
8.74%
5.83%
3.88%
Stage II only
✗
✗
✓
1.02
2.97%
1.98%
0.00%
0.00%
AscendOptimizer
✓
✓
✓
1.21
18.81%
12.87%
10.89%
9.90%
Table 3: Component ablation. Results are computed over all 101 operators. Each variant is run independently with the same 230-evaluation budget per operator. Columns >p report fast p , the fraction of operators with speedup greater than p× . Higher is better.
Figure 3: Cross-operator transfer for upsample_nearest_exact3d . A loop-consolidation pattern mined from clip_by_value_v2 transfers to the target operator; without retrieval, oracle bottleneck guidance rarely finds the same rewrite.
Figure 4: Code-and-curve case study for matmul_all_reduce , showing the different roles of kernel refinement and host-side tiling search.
Appendix figures & tables1 asset
Supplementary material from the paper’s appendix.
Appendix
Aspect
Official Ascend C Best Practices
Experience Bank in This Work
Knowledge form
Principle-level guidance for human developers
Concrete optimization episodes with code-level rewrites and applicability conditions
Primary role
Explain common optimization principles
Support direct retrieval and transfer during automated operator optimization
Efficient custom operators are essential for modern deep learning workloads, yet developing high-performance kernels for Ascend NPUs remains slow, expert-intensive, and difficult to automate. Although AI agents now approach expert performance on GPU kernel benchmarks, current models remain less capable of generating AscendC kernels for NPUs, potentially reflecting the relative scarcity of relevant training data. We thus present CAKE, a CANN-native system for deployable custom operators that combines adaptive multi-DSL routing, separate Generation and Evolution modes, and reviewed knowledge reuse through CAKE Book and a Self-Evolving Agent. On 53 CANN-Bench v1.1 operators on Ascend 950PR, CAKE's aggregated results achieve 100% case pass rate on the standard set (1,060/1,060) and 98.28% on the hidden set (4,167/4,240), with an overall mean score of 78.63 out of 100 and an average performance speedup of 1.334× over the baseline. Evolution then pushes correct operators further: EngramGateFusion cuts aggregate device time by 46.6% over 20 rounds and roughly halves the mean roofline gap. These results offer a practical path toward closing Ascend's AI-for-kernel capability gap.
Ascend C operator optimization is critical for NPU (Neural Processing Unit) inference performance but requires deep hardware expertise. While large language models (LLMs) have shown promise in automated CUDA kernel generation, the fundamentally different programming model of Ascend C introduces unique challenges that remain unexplored. In this paper, we propose AgenticCANN, a knowledge-augmented agentic evolution framework specifically tailored for automated Ascend C operator synthesis in low-corpus NPU environments. To overcome the severe platform knowledge deficit on unfamiliar hardware, AgenticCANN incorporates a knowledge-orchestrated generation system that delivers structured, multi-level domain insights across the development lifecycle to resolve the upstream feasibility bottleneck. Building on this foundation, it features a stage-adaptive agentic evolution strategy that dynamically aligns LLM interaction modes with specific generation and evolution phases, balancing high-exploration candidate discovery with high-convergence performance tuning. Extensive experiments on Huawei Ascend 910B across six operators spanning five pattern categories demonstrate that our method achieves 90 to 100 percent feasibility on elementwise and normalization operators, 56% on fusion operators, and up to 6.65× speedup on 1B Pangu model inference kernels. Further analysis reveals that knowledge injection monotonically improves feasibility from 57% to 86% on elementwise operators, demonstrating its general rather than operator-specific benefit.
Junhao Qiu, Zidong Wang, Yansong Sun +3
Department of Computer Science, City University of Hong Kong · Hong Kong Yuwin Technology Co., Ltd
LLM agents have become capable kernel engineers on mainstream GPU stacks, but they struggle on emerging accelerators such as Ascend NPUs, whose programming model is barely represented in pretraining data. Recent NPU agents address this gap largely through experience: they accumulate memory from their own generation and optimization trials and reuse it on later tasks. We argue that experience alone is not enough for kernel generation. An agent can only remember what it has tried, and it rarely tries a mechanism it does not know. As a result, such memory offers little help when a new operator calls for a different mechanism, and even familiar operators raise unseen situations as optimization proceeds. We present ASCENDEVOLVE, which grounds every step of an evolutionary kernel search in a large external knowledge base built from platform documentation, toolkit headers, and operator repositories. Because this corpus far exceeds any context window, ASCENDEVOLVE indexes it and routes each agent to a small, task-specific slice of evidence instead of the corpus itself. The retrieved knowledge seeds diverse implementation strategies, guides repair when a candidate fails, and constrains how strong candidates are recombined. On 53 Ascend C operators from CANN-Bench spanning four difficulty levels, ASCENDEVOLVE achieves an overall score of 71.39, improving over Reflexion and OpenEvolve by 11.6% and 17.2%.
Xi Chen, Ming Shen, Haotian Yan +2
Shenzhen Loop Area Institute (SLAI) · Guangzhou University · Shanghai Jiao Tong University +2