kali20gakki/msAgent / skills/operator/ops-performance-tuning
ops-performance-tuning
VerifiedCompile, profile, diagnose, optimize, and compare Ascend NPU operators across CANN versions and A2/A3/A5 for Ascend C, CATLASS, Triton-Ascend, TileLang-Ascend, PyPTO, and SHMEM/MC2. Use when an operator already has a runnable implementation and the user asks for msOpProf collection, bottleneck analysis, source-level tuning, or a reproducible before/after performance report. Do not use as the primary workflow for operator creation, migration, or unresolved correctness failures.
references/cases/ascendc/pr_ascendc_matmul_case_18x.md
View on GitHub# 官方 Matmul 优化案例【非 PR:昇腾社区技术文章】
## 基本信息
- 算子类别:matmul
- DSL/框架:ascendc
- 类型:非PR(社区文章,昇腾社区"Ascend C 算子开发全流程实战")
- 来源可信度:官方文档(昇腾社区官方技术文章,CSDN 镜像)
## 来源链接
- PR/出处链接:<https://cann.csdn.net/69ef0abd0a2f6a37c5a653b7.html>( 已验证可达,验证日期 2026-08)
- 优化代码查看:社区文章案例,非代码仓 PR,无 diff/files 页;优化措施与数字以原文表格为准
## 问题与瓶颈
Profiling 显示 `aic_mte2_ratio` = 0.92(内存带宽瓶颈),初始执行 11200 us。
## 优化方法(理论手段)
1. **优化分核逻辑**:多核负载均衡(分核数 4 → 20),11200 us → 2350 us。
2. **优化基本块切分**:tiling 基本块放大(baseM/baseN 64/64 → 128/256),提升计算/搬运比,→ 810 us。
3. **开启大包搬运**(CANN 7.0.0):合并小粒度搬运降低 MTE 指令开销,→ 620 us。
## 性能对比
| 优化措施 | 分核数 | baseM/baseN | 大包搬运 | 执行时间 |
|---|---|---|---|---|
| 优化前 | 4 | 64/64 | 关 | 11200 us |
| 优化分核逻辑 | 20 | 64/64 | 关 | 2350 us |
| 优化基本块切分 | 20 | 128/256 | 关 | 810 us |
| 开启大包搬运 | 20 | 128/256 | 开 | **620 us** |
累计约 18 倍。
## 适用范围与警示
- 适用:Matmul 类算子内存带宽受限场景;大包搬运特性依赖 CANN 7.0.0。具体适用 shape/dtype/芯片原文未附。
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| planning-and-task-breakdownaddyosmani/agent-skillsBreaks work into ordered tasks. Use when you have a spec or clear requirements and need to break work into implementable tasks. Use when a task feels too large to start, when you need to estimate scope, or when parallel work is possible. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| screenpipethedotmack/claude-memSearch screen and audio history recorded by Screenpipe and optionally save selected context into claude-mem. Use when the user asks to recall desktop activity, a meeting, or something seen in another app through Screenpipe. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| contact-widgetnexu-io/open-designSelf-contained floating chat widget with welcome screen, social links, meeting button, and message input. Single HTML file, zero dependencies. | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |
| meeting-notesnexu-io/open-designMeeting notes page — title bar with attendees, agenda checklist, decisions block, action items table with owners + dates, and a "next meeting" footer. Use when the brief mentions "meeting notes", "minutes", "1:1 notes", "all-hands recap", or "会议纪要". | Stars: 108k | Updated | Claude CodeCodex | Verified | Install |