Ascend/msagent / skills/profiler/ascend-prof-compare
ascend-prof-compare
VerifiedCompares two Prof datasets (GPU vs NPU / NPU vs NPU) by auto-installing and calling msprof-analyze compare, then parses the result xlsx into HTML report and Chinese xlsx. Invoke when user provides two prof dirs to compare, or has a compare result xlsx to analyze/translate.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 11.2 KB |
| references/analysis_methodology.md | markdown | 15.1 KB |
| references/compare_quickstart.md | markdown | 3.6 KB |
| scripts/csv_translator.py | script | 8.2 KB |
| scripts/html_generator.py | script | 38.7 KB |
| scripts/main_analyzer.py | script | 11.8 KB |
| scripts/parsers/__init__.py | script | 35 B |
| scripts/parsers/api_compare.py | script | 3.1 KB |
| scripts/parsers/common.py | script | 1.6 KB |
| scripts/parsers/communication.py | script | 2.5 KB |
| scripts/parsers/kernel.py | script | 13.3 KB |
| scripts/parsers/memory.py | script | 3.6 KB |
| scripts/parsers/module.py | script | 4.1 KB |
| scripts/parsers/operator.py | script | 4.0 KB |
| scripts/parsers/overall_metrics.py | script | 5.9 KB |
| scripts/run_compare.py | script | 9.3 KB |
references/compare_quickstart.md
View on GitHub# msprof-analyze compare 参数速查与数据准备
本文件供直比模式(`run_compare.py`)执行时参考:如何校验用户提供的 Prof 数据、如何为 `--compare_args` 挑选合适的参数。
## 1. Prof 数据格式校验
compare 支持任意两边组合:GPU vs NPU、NPU vs NPU、GPU vs GPU(同构亦可)。
### NPU 数据(TorchNPU / MindSpore)
目录需指定到以下任意一层级:
```text
# TorchNPU(Text 格式)
*_ascend_pt/
├── ASCEND_PROFILER_OUTPUT/
│ ├── kernel_details.csv
│ ├── op_statistic.csv
│ └── trace_view.json
├── FRAMEWORK/
└── PROF_*/
# TorchNPU(Db 格式)
*_ascend_pt/
└── ASCEND_PROFILER_OUTPUT/
├── analysis.db
└── ascend_pytorch_profiler_{rank_id}.db
# MindSpore
profiler/{rank-*}_{timestamps}_ascend_ms/
└── ASCEND_PROFILER_OUTPUT/
```
- Text 与 Db 格式均可比对;同一目录两者同时存在时,工具优先使用 Db 格式
- `--enable_api_compare` 依赖 `trace_view.json`(Text 格式)
### GPU 数据(torch.profiler 导出)
```text
pytorch_profiling/
└── *.pt.trace.json
```
- 建议采集时开启 `profile_memory=True`(内存比对)与 `record_shapes=True`(Shape 匹配)
### Step 要求
- 建议只采集一个 step 的数据;多 step 数据会混入预热/抖动,影响 E2E、通信等待等判断
- 多 step 场景需固定比对步:`--compare_args "--base_step=<基准step> --comparison_step=<比对step>"`(两者必须成对配置,且 step 需实际存在)
## 2. 参数选择决策
按用户关注点选择开关(设置了任意开关后,工具只执行已设置的比对能力;全部不设则开启全部):
| 用户诉求 | 推荐参数 |
|---|---|
| 快速定界:差异来自计算/通信/调度哪个方向 | `--enable_profiling_compare` |
| 哪些算子劣化了 | `--enable_operator_compare` |
| 通信慢在哪 | `--enable_communication_compare` |
| 内存涨在哪 | `--enable_memory_compare` |
| NPU vs NPU 看 Kernel 细节 | `--enable_kernel_compare`(可加 `--use_kernel_type` 提速) |
| Host 侧下发慢 | `--enable_api_compare` |
| 全量分析(默认) | 不传任何 `--enable_*` 开关 |
### 辅助参数
| 参数 | 使用时机 |
|---|---|
| `--disable_details` | 只要统计结论、明细 Sheet 太大或比对太慢时 |
| `--disable_module` | 无需模块级比对(双方都有 Python Function 时默认输出 Module Sheet) |
| `--use_input_shape` | 同名算子多 Shape、需精确匹配时 |
| `--max_kernel_num=N`(最小 4) | 需要更细粒度的算子比对(逐层下钻子算子)时 |
| `--op_name_map={'a':'b'}` | GPU/NPU 算子命名不一致(如融合算子改名)时 |
| `--gpu_flow_cat=<标识>` | GPU trace 中 Device Duration 全为 0 时,从 chrome://tracing 的 Flow events 找连线标识填入 |
| `--force` | 提示文件属主/大小校验失败时强制执行 |
| `--debug` | compare 报错需要定位原因时 |
## 3. 输出与后续分析
- compare 成功后在输出目录生成 `performance_comparison_result_<时间戳>.xlsx`,并在终端打印总体比对结果(含 `Mem Usage`)
- `run_compare.py` 会自动定位最新 xlsx 并调用 `main_analyzer.py` 完成 Sheet 级解析、HTML 报告与中文 xlsx 生成
- 常见报错排查:
- `Sheet 不存在`:对应 `--enable_*` 开关未开启,或数据类型不支持(如 MindSpore 不支持算子/内存比对)
- `无明细 Sheet`:`--disable_details` 已设置
- `Not minimal profiling` 警告:E2E 时间存在性能膨胀,影响通信/调度耗时判断,建议按最小化采集重新采集数据
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |