ascendc-operator-performance-optim
排查并优化 Ascend C 算子性能。当用户开发、审查或优化 Ascend C kernel 算子时使用,或当用户提及 Ascend C 性能优化、算子优化、tiling、流水、搬运、 内存优化、NPU/昇腾等关键词时触发。
Skill by Ascend
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/ascend-ascendc-operator-performance-optim
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/ascendc-operator-performance-optim
What's inside
- Skill name
ascendc-operator-performance-optim- Description
- 排查并优化 Ascend C 算子性能。当用户开发、审查或优化 Ascend C kernel 算子时使用,或当用户提及 Ascend C 性能优化、算子优化、tiling、流水、搬运、 内存优化、NPU/昇腾等关键词时触发。
- License
- MulanPSL-2.0
- Instructions
- 438 lines in SKILL.md · view on GitHub
Files (6)
- SKILL.md
- api-usage-prof.md · references/
- data-copy-prof.md · references/
- memory-prof.md · references/
- pipeline-prof.md · references/
- tiling-prof.md · references/
SKILL.md (first lines)
# Ascend C 算子性能优化(排查 → 修改 → 验证 闭环) 本 skill 不仅排查性能问题,还负责 **修改代码并验证优化效果**。完整流程为: ``` Phase 1: 排查 — 审查代码 + 学习设计文档,发现优化点 Phase 2: 基线 — 保存当前性能测试结果(自定义算子 vs 标杆) Phase 3: 优化 — 学习 code-gen 知识后修改算子代码 Phase 4: 精度 — 精度验证(确保优化后功能正确) Phase 5: 性能 — 同 case 性能对比(优化后 vs 标杆) Phase 6: 迭代 — 未提升则继续优化,最多 3 轮 ``` --- ## Phase 1: 排查 — 发现优化点 ### 1.1 学习算子设计文档 **MANDATORY — 排查前必须先理解算子设计**: 1. 读取 `ascend-kernel/csrc/ops/<op_name>/design.md`(若存在),提取: - 算子类型(elementwise / 行处理 / Cube) - Tiling 策略(核间切分 / 核内切分) - UB 空间分配方案 - 计算逻辑与数据流 2. 读取 `op_host/<op_name>.cpp` 和 `op_kernel/<op_name>.cpp` 全部源码 ### 1.2 逐阶段排查 按以下顺序逐阶段审查算子代码。对每个阶段,加载对应的 reference 文件,逐项 对照代码检查。 ``` - [ ] 1. Tiling — 数据在多核与 L2Cache 间的切分策略 - [ ] 2. 搬运 — DataCopy 的带宽利用率 - [ ] 3. API 使用 — Ascend C API 的高效用法 - [ ] 4. 内存 — 数据在存储层级中的放置策略 - [ ] 5. 流水 — CopyIn / Compute / CopyOut 的重叠执行 ``` 每个阶段有独立的 reference 文件,排查时**仅加载当前阶段**的文件: - 阶段 1:[references/tiling-prof.md](references/tiling-prof.md) - 阶段 2:[references/data-copy-prof.md](references/data-copy-prof.md) - 阶段 3:[references/api-usage-prof.md](references/api-usage-prof.md) - 阶段 4:[references/memory-prof.md](references/memory-prof.md) - 阶段 5:[references/pipeline-prof.md](references/pipeline-prof.md) #### 1. Tiling > 详细示例:[references/tiling-prof.md](references/tiling-prof.md) 排查项: - [ ] **1.1 多核切分**:`blockDim` 是否设为硬件核数? - 耦合架构:`GetCoreNumAiv()` 或 `GetCoreNumAic()` - 分离架构 Vector 算子:AIV 核数(如 40) - 分离架构 Cube 算子:AIC 核数(如 20) - 分离架构 MIX 算子:物理核组数(如 20 = 40 AIV / 2),不可超过物理核数 - [ ] **1.2 L2Cache 切分**:当 `输入 + 输出 > L2Cache 容量` 时,是否将数据 按 L2Cache 大小分块,所有核协同处理同一块后再切换下一块? - [ ] **1.3 核间负载均衡**:L2Cache 切分后,尾块是否在各 pass 间交替分配, 避免固定某些核始终拖尾? #### 2. 搬运 > 详细示例:[references/data-copy-prof.md](references/data-copy-prof.md) 排查项: - [ ] **2.1 单次搬运量 >= 16 KB**:每次 `DataCopy` 是否搬运至少 16 KB? 小于此值带宽利用率显著下降。 - [ ] **2.2 GM 地址 512B 对齐**:GM 起始地址是否 512 字节对齐? (Atlas A2 系列上,32B 对齐比 512B 对齐带宽最多低 30%。) - [ ] **2.3 stride 参数代替 for 循环**:间隔搬运是否使用 `DataCopyParams` (blockCount/blockLen/srcStride/dstStride)一次下发,而非用 for 循环逐行搬运? #### 3. API 使用 > 详细示例:[references/api-usage-prof.md](references/api-usage-prof.md) 排查项: - [ ] **3.1 TPipe 在 kernel 类外创建**:`TPipe` 是否在 kernel 入口函数中创建 并以指针传入类?(类内 TPipe 会阻止 Scalar 常量折叠,增加约 17% scalar_time。) - [ ] **3.2 纯搬运算子使用 TQueBind**:无 Vector 计算的算子是否用 `TQueBind<VECIN, VECOUT>` 替代了分离的 `TQue<VECIN>` + `TQue<VECOUT>`? (消除冗余的 LocalTensor 间 DataCopy,`aiv_vec_time` 降至约 0。) - [ ] **3.3 Counter 模式(SetMaskCount)**:Vector 指令是否使用 Counter 模式, 而非 Normal 模式手动计算主块/尾块 mask? - [ ] **3.4 Matmul AtomicAdd**:Matmul 结果 C 需要与 GM 矩阵 D 相加时, 是否在 `IterateAll`/`GetTensorC` 中设置 `enAtomic=1` 融合累加? (可减少约 12% cycle。) - [ ] **3.5 归约指令组合**:连续 buffer 归约到标量时,是否使用 `BlockReduceSum` + `WholeReduceSum` 组合,而非多次相同归约指令? #### 4. 内存 > 详细示例:[references/memory-prof.md](references/memory-prof.md) 排查项: - [ ] **4.1 UB Buffer 融合**:连续 Vector 运算(如 Exp → Abs)的中间结果 是否留在 UB 内,而非经 GM 往返? - [ ] **4.2 L0C 累加矩阵乘**:`A1*B1 + A2*B2 + ...` 场景下,Mmad 结果是否 在 CO1(L0C)中原地累加,而非逐次写 GM 再在 UB 求和? - [ ] **4.3 小矩阵长驻 L1**:当 L1 无法同时容纳左右矩阵时,较小矩阵是否 一次加载后常驻 L1,仅循环搬运较大矩阵? - [ ] **4.4 BT Buffer 存放 bias**(分离架构):bias 是否存入 BT Buffer(C2) 并通过 `Mmad` 一步融合,而非在 UB 中单独做 Add? - [ ] **4.5 FP Buffer 存放量化参数**(分离架构):量化参数是否存入 FP Buffer(C2PIPE2GM)并通过 `Fixpipe` 随路量化,而非在 UB 中单独计算? #### 5. 流水 > 详细示例:[references/pipeline-prof.md](references/pipeline-prof.md) 排查项:
From Ascend/agent-skills, MulanPSL-2.0.
More from Ascend/agent-skills
- 0.573score
ascendc-operator-design
Ascend
完成AscendC算子设计 - 帮助用户完成算子的架构设计、接口定义和性能规划。当用户提到算子设计、算子开发、tiling策略、内存规划、AscendC kernel设计、两级tiling、核间切分、核内切分时,使用此skill。
SkillCFreshness: C★ 52Claude Code +9 - 0.571score
ascend-transformer-boost
ascend-transformer-boost-team + Claude + Claude Code + deepseek-v4-pro
昇腾 Transformer 加速库(ATB)核心技能集索引(Index Skill)。 整合 8 大核心技能:CANN 安装部署、ATB 测试框架编译、 ATB→ACLNN 算子替换设计文档生成、ATB→ACLNN 算子迁移,覆盖昇腾 NPU 开发全链路。
SkillCFreshness: C★ 52Claude Code +9 - 0.570score
k8s-check-fix
Ascend
Kubernetes 集群健康检查与安全修复 — 诊断问题,用户确认后执行修复
SkillCFreshness: C★ 52Claude Code +9 - 0.567score
cann-nnal-installer
Ascend
昇腾NPU CANN Toolkit+Kernels+NNAL安装部署技能。支持从官网下载run包安装和从Docker镜像提取两种方式,覆盖驱动检查、包下载、安装、环境变量配置与验证全流程。当用户需要安装CANN全套组件或指定版本CANN到自定义路径时调用。
SkillCFreshness: C★ 52Claude Code +9 - 0.522score
ascendc-operator-code-gen
Ascend
No description from the publisher yet.
SkillCFreshness: C★ 52Claude Code +9 - 0.514score
ascend-profiling-anomaly
Ascend
Analyze Huawei Ascend NPU profiling data to discover hidden performance anomalies and produce a detailed model architecture report reverse-engineered from…
SkillDFreshness: D★ 52Claude Code +9 - 0.514score
hccl-test
Ascend
HCCL (Huawei Collective Communication Library) performance testing for Ascend NPU clusters.
SkillDFreshness: D★ 52Claude Code +9 - 0.514score
megatron-migration-generator
Ascend
Generate migration deliverables for bringing relevant Megatron changes into MindSpeed after branch alignment and impact mapping are complete.
SkillDFreshness: D★ 52Claude Code +9 - 0.514score
ascend-docker
Ascend
Create Docker containers for Huawei Ascend NPU development with proper device mappings and volume mounts.
SkillDFreshness: D★ 52Claude Code +9 - 0.514score
ascendc-operator-performance-eval
Ascend
在 ascend-kernel 的 csrc/ops/<op>/test 下维护仅含 JSONL 的 profiler 性能用例,使用 torch_npu.profiler(固定 warmup=5、active=5)采集,汇总 ASCEND_PROFILER_OUTPUT/op_statistic.csv 的…
SkillDFreshness: D★ 52Claude Code +9 - 0.514score
ascendc-operator-code-review
Ascend
Ascend C 代码检视技能。基于假设检验方法论对代码进行安全规范检视。调用时必须明确提供:代码片段和检视规则描述。TRIGGER when: 用户要求代码检视、代码review、询问代码安全问题、检查编码规范、或需要检查特定代码问题(如内存泄漏、整数溢出、空指针等)。关键词:Ascend…
SkillDFreshness: D★ 52Claude Code +9 - 0.511score
ascendc-operator-precision-debug
Ascend
AscendC 算子精度问题调试与根因定位。当算子精度测试失败(allclose 不通过、结果偏差、输出全零/NaN 等)时使用。流程:误差分布分析 → 代码易错点审查 → 实验隔离 → printf/DumpTensor 插桩 → 修复验证。关键词:精度调试、精度问题、结果不一致、误差定位、allclose…
SkillDFreshness: D★ 52Claude Code +9
Signals
- Stars
- 52
- Forks
- 3
- Open issues
- 2
- Last commit (this folder)
- May 7, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MulanPSL-2.0
- Repository
- github.com/Ascend/agent-skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Ascend
- 0.573score
ascendc-operator-design
Ascend
完成AscendC算子设计 - 帮助用户完成算子的架构设计、接口定义和性能规划。当用户提到算子设计、算子开发、tiling策略、内存规划、AscendC kernel设计、两级tiling、核间切分、核内切分时,使用此skill。
SkillCFreshness: C★ 52Claude Code +9 - 0.570score
k8s-check-fix
Ascend
Kubernetes 集群健康检查与安全修复 — 诊断问题,用户确认后执行修复
SkillCFreshness: C★ 52Claude Code +9 - 0.567score
cann-nnal-installer
Ascend
昇腾NPU CANN Toolkit+Kernels+NNAL安装部署技能。支持从官网下载run包安装和从Docker镜像提取两种方式,覆盖驱动检查、包下载、安装、环境变量配置与验证全流程。当用户需要安装CANN全套组件或指定版本CANN到自定义路径时调用。
SkillCFreshness: C★ 52Claude Code +9 - 0.522score
ascendc-operator-code-gen
Ascend
No description from the publisher yet.
SkillCFreshness: C★ 52Claude Code +9 - 0.514score
ascend-docker
Ascend
Create Docker containers for Huawei Ascend NPU development with proper device mappings and volume mounts.
SkillDFreshness: D★ 52Claude Code +9 - 0.514score
hccl-test
Ascend
HCCL (Huawei Collective Communication Library) performance testing for Ascend NPU clusters.
SkillDFreshness: D★ 52Claude Code +9
Cite this page
ascendc-operator-performance-optim skill. Agent Mart. https://agentmart.dev/skills/ascend-ascendc-operator-performance-optim (last updated 2026-10-24)