Skip to content
cccskills
FreePublished on GitHub

deterministic-calculation-analysis

执行msProbe数据比对并分析比对结果,定位确定性计算问题首个输入一致输出不一致的API。

The English summary is being prepared. Showing the original description.

See how to install

Files included (5)

  • SKILL.md8.1 KB
  • scripts/find_first_diff_api_L1.py9.7 KB
  • scripts/find_first_diff_api_mix.py12.6 KB
  • scripts/md5_dump_files_checker.py7.3 KB
  • scripts/msprobe_utils.py3.3 KB

SKILL.md (original)

Review the instructions the agent will receive before you install.

确定性计算比对分析

技能目标

  1. 数据比对 — 调用 msProbe 工具比对两份 dump 数据,生成比对结果文件
  2. 结果分析 — 分析比对结果,寻找首个输入一致输出不一致的计算 API
  3. 排除误检 — 支持排除特定 API 后重新分析,直至定位根因

分析流程

⚠️ 硬性规则

  1. 第 1 步(用户输入数据校验)适用于所有路径类型,不可跳过。 即使是 db/csv_xlsx 路径,也必须先跑 md5_dump_files_checker.py 校验数据完整性。
  2. 仅"第 2 步依赖检查(pip install)"和"第 3 步数据比对(msprobe compare/graph_visualize)"可根据路径类型跳过。

1. 用户输入数据校验

用户提供路径,支持三种输入类型:

输入类型参数个数说明
dump 路径2 个target(调试侧)和 golden(标杆侧)两份 msProbe 工具 dump 数据目录。示例:dump_path/step0。
db 路径1 个mix 级别比对结果文件(.vis.db)或包含该文件的目录。示例:db_path 或 db_path/compare_*.vis.db。
csv/xlsx 路径1 个L1 级别比对结果文件(.csv/.xlsx)或包含该文件的目录。示例:csv_path 或 csv_path/compare_*.csv。
# dump 路径(2 个参数)
python3 "<skill_root>/scripts/md5_dump_files_checker.py" <target_path> <golden_path>

# db 或 csv/xlsx 路径(1 个参数)
python3 "<skill_root>/scripts/md5_dump_files_checker.py" <db_or_csv_path>
  • 校验通过 → 输出 level="L1" 或 level="mix",继续下一步
  • 校验不通过 → 输出异常原因,终止流程
  • 打印内容包含“没有包含tensor的CRC-32校验值,无法分析确定性问题”、“缺失md5”相关内容 → 终止流程,提示用户必须使用包含 tensor 的 CRC-32 校验值的文件,采集数据的config.json配置必须指定task="statistics"和summary_mode="md5"

2. 依赖检查(仅 dump 路径需要)

db 和 csv/xlsx 路径已包含比对结果,无需依赖 msProbe 工具。

pip3 show mindstudio-probe || pip3 install mindstudio-probe --pre

3. 数据比对(仅 dump 路径需要)

根据第 1 步输出的 level 选择对应分支。比对等待时间最长为 600 秒。

3.1 level="L1"
msprobe compare -tp <target_path> -gp <golden_path> -o <output_path>
3.2 level="mix"
msprobe graph_visualize -tp <target_path> -gp <golden_path> -o <output_path>

4. 数据分析

根据第 1 步输出的 level 和第 1 步输入的路径类型选择对应分支。所有分支都支持 --exclude-api 排除后重分析。

4.1 输入为 dump 路径(比对结果已生成)

4.1.1 level="L1"
python3 "<skill_root>/scripts/find_first_diff_api_L1.py" <output_path>

分析特点:

  • 无 Module 层级信息,仅有 API 级 md5 比对
  • 找不到问题 API 时自动检测"状态跳变边界",提示可能漏采的位置
  • 支持 --exclude-api "API名称" 排除误检后重新分析
4.1.2 level="mix"
python3 "<skill_root>/scripts/find_first_diff_api_mix.py" <output_path>/compare_*.vis.db

分析特点:

  • 包含 API 和 Module 两级分析,展示父子层级链路
  • 当 API 级找不到结果、但 Module 级发现异常时,提示可能漏采的 API
  • 支持 --exclude-api "API名称" 排除误检后重新分析

4.2 输入为 db 或 csv/xlsx 路径(跳过比对,直接分析)

已有比对结果文件,直接进行分析。

4.2.1 level="mix"(db 路径)
python3 "<skill_root>/scripts/find_first_diff_api_mix.py" <db_path>
4.2.2 level="L1"(csv/xlsx 路径)
python3 "<skill_root>/scripts/find_first_diff_api_L1.py" <csv_xlsx_path>

5. 输出

展示比对分析的结果并进行解读。

5.1 找到问题 API

展示首个输入一致输出不一致的 API,包括其 Module 层级链路(仅 mix)和 md5 比对详情:

+----------------------+------------------------------------------+
|                     Rank 0                              |
+----------------------+------------------------------------------+
| 首个问题API           | NPU.npu_rms_norm.0.backward              |
+----------------------+------------------------------------------+
| API所在Module层级     | DefaultModel [Module]                    |
|                      |   → input_layernorm.RMSNorm [Module]     |
|                      |   → NPU.npu_rms_norm.0.backward [API]    |
+----------------------+------------------------------------------+
| API分析依据           | Input MD5 (全部一致)                     |
|                      | Output MD5 (不一致)                      |
|                      |   output.1: NPU=xxx vs Bench=yyy         |
+----------------------+------------------------------------------+

找到首个问题 API 即排查结束,后续只让用户选择是否排除该 API 重新分析。如果用户选择排除,则让用户输入要排除的 API 名称(支持前缀匹配,多个以空格分隔),内部重新执行分析流程。

5.2 未找到问题 API(状态跳变)

+----------------------+------------------------------------------+
| 首个问题API           | 无                                       |
+----------------------+------------------------------------------+
| API分析依据           | 最后一个正常API: xxx                     |
|                      | 第一个输入不匹配API: yyy                 |
|                      | 两者之间的API可能被msprobe漏采           |
+----------------------+------------------------------------------+

解读: 未找到输入完全一致但输出不一致的 API,说明根因 API 可能被 msProbe 漏采。两个边界 API 之间的区域即为可疑范围,可调整 msProbe 采集配置后重新 dump 分析。

关键字段说明

db(mix 级别)

字段说明
node_nameAPI/Module 名称
node_order执行顺序,越小越先执行
node_type0=Module, 1=API
data_sourceNPU=调试侧, Bench=标杆侧
precision_index0=pass, 1=error
up_node / sub_nodes父子层级关系
input_data / output_data输入/输出数据,JSON 格式,包含 md5 值
is_distributed是否为通信算子

csv/xlsx(L1 级别)

字段说明
NPU Name调试侧 API 名称
Bench Name标杆侧 API 名称
NPU MD5调试侧 tensor CRC-32 值
BENCH MD5标杆侧 tensor CRC-32 值
Result比对结果(pass/fail)
NPU Tensor Shape调试侧张量形状
Bench Tensor Shape标杆侧张量形状

dump 路径说明

多卡场景

dump_path
└── step0
    ├── rank0
    │   ├── construct.json
    │   ├── dump.json
    │   └── stack.json
    ├── rank1
    │   ├── construct.json
    │   ├── dump.json
    │   └── stack.json
    ...
    └── rank7
        ├── construct.json
        ├── dump.json
        └── stack.json
└── step1
│   ├── ...
└── step2
...

单卡场景

dump_path
└── step0
    └── proc{pid}
        ├── construct.json
        ├── dump.json
        └── stack.json
└── step1
│   ├── ...
└── step2
...

比对说明

  • level="mix",调用msprobe graph_visualize,用户可以传入路径dump_path、dump_path/step{n}、dump_path/step{n}/rank{n}或者dump_path/step{n}/proc{pid}。
  • level="L1",调用msprobe compare,用户可以传入路径dump_path/step{n}、dump_path/step{n}/rank{n}或者dump_path/step{n}/proc{pid},不支持比对dump_path。如果用户传入dump_path,默认比对dump_path/step0。

Reviews

No reviews yet. Tell others what you thought.

Comments

No login needed. Share how it worked for you, ask a question, or note where it did not run.

No comments yet. Be the first to write one.

Comments are published right away. Do not include personal information such as email addresses or phone numbers. Up to 2 URLs.

0 / 1,000 characters

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.

More skills from this repository

当用户直接要求进行数据集压缩测评,或在量化调优过程中需要使用 AISBench 评测工具输出数据集精度等场景时使用。 本 Skill 负责:使用 AISBench 数据集压缩代码、用 RBF Kernel Herding 算法生成压缩后的数据子集(coreset),并按用户目标交付两种产物之一: ① 接入量化调优主流程:产出独立的 coreset 数据集配置(不覆盖原始数据),回传「全集 config_name + coreset config_name」给编排层,供 evaluation.yaml 切换; ② 仅数据集压缩测评(不做量化调优):基于 example 模板生成「全集测试脚本」和「子集测试脚本」两份 shell 脚本。 暂时支持 AIME 2025 和 GPQA,其他数据集需要再结合 aisbench tools目录下 herding_coreset_selector 源码进行分析。

The English summary is being prepared. Showing the original description.

kali20gakki/msAgent32Updated Oct 22, 2026

Ascend cluster comparison tool. Invoke when user asks to compare two cluster datasets (DB or TEXT), or to generate cluster_analysis_output from raw profiling data via msprof-analyze and then compare.

The English summary is being prepared. Showing the original description.

kali20gakki/msAgent32Updated Oct 22, 2026

专门用于 Ascend 集群 Profiling 性能数据的“快慢卡”诊断专家技能。当用户提供【集群性能数据目录/路径】并要求分析【快慢卡】、【慢节点】、【负载不均衡】或【集群瓶颈】时,必须触发此技能。该技能会自动接收集群路径,调度相关工具输出快慢卡的宏观定性与微观根因(如 Host 下发瓶颈、算子计算劣化)。

The English summary is being prepared. Showing the original description.

kali20gakki/msAgent32Updated Oct 22, 2026

Analyze Ascend NPU collective communication profiling data with a DB-first workflow. Use when the user provides `cluster_analysis_output/cluster_analysis.db`, rank-level `analysis.db`, rank-level `ascend_pytorch_profiler_{rank_id}.db`, together with `profiler_info.json`, and asks about HCCL or hcom communication cost, collective communication TOP ops, wait time, slow rank/straggler, Notify Wait, bandwidth, retry, relay, SDMA/RDMA/HCCS links, communication matrix, or Ascend communication fault patterns.

The English summary is being prepared. Showing the original description.

kali20gakki/msAgent32Updated Oct 22, 2026

Analyze Ascend NPU computation-side profiling data for single-card runs or a selected rank from multi-card runs. Use this skill when the user asks to diagnose computation bottlenecks, AI Core / AI Vector / AICPU hotspots, dynamic shape overhead, block dim issues, redundant TransData/Transpose/Cast, cross-stream waits, frequency/runtime-state issues, or fusion opportunities.

The English summary is being prepared. Showing the original description.

kali20gakki/msAgent32Updated Oct 22, 2026

针对昇腾 NPU 上的 PyTorch 模型,识别可做融合算子替换的代码段、替换为 torch_npu 融合算子并做性能/精度验证。当用户提到融合算子、NPU 算子替换、RMSNorm/SwiGLU/RoPE/Attention 融合、torch_npu 亲和算子等关键词是,使用本 Skill。

The English summary is being prepared. Showing the original description.

kali20gakki/msAgent32Updated Oct 22, 2026

See all skills by kali20gakki

Report a problem with this skill