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_allgathermm_scalar_align.md
View on GitHub# MR !9716(ops-transformer)AllGatherMM Scalar 与尾块对齐优化【PR】
## 基本信息
- 算子类别:communication(MC² / AllGather + MatMul)
- DSL/框架:ascendc
- 类型:PR
- 来源可信度:一手 PR 合并描述(GitCode 仓首页提交记录)
## 来源链接
- PR/出处链接:<https://gitcode.com/cann/ops-transformer/pull/9716>( 路由可达,合并描述已核验,验证日期 2026-08)
- 优化代码查看:<https://gitcode.com/cann/ops-transformer/pull/9716/files>( 路由可达,验证日期 2026-08;重点目录 `mc2/`)
## 问题与瓶颈
AllGatherMM 用例存在 Scalar 侧 `fragmentTensor` 基础接口开销;Host Tiling 的尾块 M 未按要求对齐,导致 L0C 回写 GM 地址出现 1024 非对齐并触发精度异常。原文未附量化时延。
## 优化方法(理论手段)
1. **缩短基础接口热路径**:优化 `fragmentTensor` 基础接口,降低循环内 Scalar 地址/元数据处理成本。
2. **尾块 M 做 16 对齐**:在 Host Tiling 阶段修正尾块形状,保证 L0C→GM 回写地址与硬件约束一致。
3. **精度与性能脚本同步修改**:对齐改变后同时更新两类验证脚本,避免“性能快但覆盖错 shape”或“精度脚本仍按旧布局”造成误判。
## 性能对比
原文未附量化数字。
## 适用范围与警示
- 适用于 MC²、AllGatherMM 及其他通信后接 Cube 的尾块场景。
- 这是“Scalar 性能 + 精度对齐”联合修复;对齐 padding 会改变实际处理量,前后对比必须固定逻辑 shape 并记录物理 tile。
- MC² 多 rank 应使用支持通算流水的 `msprof op`/msOpProf 采集方式;不可只采单 kernel 后下端到端结论。
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 |