mocchibird/ascend-agent-kit/ops-profiling

Claude Code and agent skill by mocchibird/ascend-agent-kit

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

NPU 性能采集与分析,融合 msprof 算子级瓶颈定位与 kernel-level 对比测试,用于采集算子性能数据、对比自定义算子 vs 标杆加速比、定位性能瓶颈并给出优化建议。当用户在算子开发过程中提到"上板性能"、"算子性能测试"、"硬件性能验证"、"NPU性能采集"、"NPU profiling"、"性能对比"、"加速比"等场景时触发。

Install

npx vskill@latest install mocchibird/ascend-agent-kit/ops-profiling

SKILL.md

The same SKILL.md was published earlier as tasselszcx/ako-npu/ops-profiling.

上板性能采集与调优

在真实 NPU 上采集算子性能数据,系统化解读指标文件,判定性能是否达标,定位瓶颈类型,并给出可操作的优化建议。

本技能基于 msprof 工具链,统一入口为两个脚本:

  • `msprof_profile_run.sh` — 性能采集(标准采集 / 对比测试 / 批量并行)
  • `msprof_perf_summary.py` — 结果解析(瓶颈分析 / 对比报告 / 批量汇总)
工具流程文档用途
`msprof_profile_run.sh``references/msprof-guide.md`统一采集入口:标准采集、对比测试、批量并行
`msprof_perf_summary.py``references/msprof-guide.md`统一解析入口:瓶颈分析、对比报告生成、批量汇总
`perf_summary.py``references/msprof-op-guide.md`msprof op 归档(需 msopprof)

使用方式

1. 标准采集模式(深度瓶颈分析)

对单个可执行文件采集 7 组 aic-metrics + sample-based:

bash
bash scripts/msprof_profile_run.sh --warm-up=3 --output=./msprof_output -- \
./matmul_tutorial_mxfp4_pingpong 8448 4096 4096
# 解析结果
python3 scripts/msprof_perf_summary.py ./msprof_output/PROF_GROUP_* <ops_dir>
2. 对比测试模式(kernel-level 加速比)

对算子目录下的 model.py vs model_new_ascendc.py 做对比测试:

bash
bash scripts/msprof_profile_run.sh --compare --output-dir=./output/GELU --warm-up=3 --device=0

输出:performance.json + performance.log + perf_report.md

3. 批量并行模式(多 NPU)

扫描目录下所有算子子目录,多 NPU 并行执行对比测试:

bash
bash scripts/msprof_profile_run.sh --batch --base-dir=./output_performance --max-jobs=7 --device-start=1

输出:各子目录 performance.json + batch_performance.log + batch_report.md + batch_summary.json


输入目录结构(对比模式)

传统模式(端到端自动开发):

{output_dir}/
├── model.py # 参考 PyTorch 实现
├── model_new_ascendc.py # AscendC 实现
├── <op_name>.json # 测试用例(JSON Lines)
└── kernel/ # AscendC kernel + whl 包

JSONL 模式(ascend-kernel 工程结构):

csrc/ops/<op>/test/
├── <op>_perf_cases.jsonl # JSONL 用例
├── model.py # 参考实现
├── model_new_ascendc.py # AscendC 实现
└── kernel/ # kernel 工程
用例加载优先级
  1. 优先:<op>_perf_cases.jsonl(标准 JSONL 命名)
  2. 回退:任意 *.jsonl 文件
  3. 回退:任意 *.json 文件(非 .bak,JSON Lines 格式)
  4. 回退:从 model.py 的 get_input_groups() 加载

输出格式(对比模式)

Markdown 报告包含:

  • 对比表:Case | Shape | DType | 自定义算子(us) | 标杆(us) | 加速比
  • 全量汇总:用例数、平均加速比、自定义/标杆更优条数
  • 按数据类型汇总:分 dtype 的统计
  • 简短分析:整体趋势结论
  • 深度瓶颈分析入口:提供 msprof 深度分析命令

额外输出:

  • performance.json — 结构化数据(含 geomean/mean/median/min/max 加速比)
  • performance.log — 打屏日志

深度分析:msprof / msprof op

当性能不达标或需要根因分析时,使用深度分析流程。

选用哪个工具:决策树
  1. 用户显式指定工具
  1. 用户未指定 — 探测环境:
参考资源
文件内容何时查阅
`references/msprof-op-guide.md`msprof op:构建 / 采集 / 归档 / 判定 / 瓶颈 / 回归选用 msprof op 时
`references/msprof-guide.md`msprof:构建 / 采集 / 归档 / 主 Bound 判定 / 瓶颈选用 msprof 时
`references/csv_fields_reference.md`CSV 字段定义与阈值理解指标含义时
`references/optimization_quickref.md`瓶颈类型与优化方法定位瓶颈后

适用场景总览

场景推荐命令说明
算子开发完成后的性能验收msprof_profile_run.sh --compare快速对比自定义算子 vs 标杆
性能问题定位msprof_profile_run.sh + msprof_perf_summary.py深度瓶颈分析
优化效果验证msprof_profile_run.sh + msprof_perf_summary.py对比优化前后的归档数据
Agent team 测试阶段--compare + 标准采集先快速对比,不达标再深度分析
端到端自动开发 Phase 5msprof_profile_run.sh --compare集成到 ascendc-ops-lab-developer 流程
批量性能测试msprof_profile_run.sh --batch多 NPU 并行批量测试

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mocchibird/ascend-agent-kit/ops-profiling/badge)](https://verified-skill.com/skills/mocchibird/ascend-agent-kit/ops-profiling)

Something wrong with this skill or its page? Tell us.