SuperAPI AI Directory

external-mindstudio-mindstudio_profiler_data_check

Data & analytics

View repository

Updated 10-15 17:19

About this skill

MindStudio Profiler Data Validation

Skill Objectives

Before in-depth performance analysis, perform a "health check" on the profiler data to ensure:

  • Correctly identify the data type (framework profiler / msprof)
  • The collection process ended normally (normal Stop process)
  • The data has been parsed and key deliverables exist
  • Identify the profiler configuration and predict the feasibility of subsequent analysis

Data Type Characteristics

Type Identifying Feature Collection Method
Framework profiler [*]_ascend_pt(PyTorch) or [*]_ascend_ms(MindSpore) Embedded in code, process-level
msprof Contains PROF_{} directory Command line, process-level

The framework profiler includes torch_npu/MindSpore framework APIs, CANN APIs, device operators, and hardware metrics; msprof includes CANN APIs, device operators, and hardware metrics.

Dependencies and Resources

  • MCP tool:msprof-mcp__get_profiler_config(profiler_path) — parses profiler_info.json (framework profiler only)
  • Offline parsing:
    • Framework profiler:scripts/offline_parse_pytorch.py <profiler_path>(PyTorch),scripts/offline_parse_mindspore.py <profiler_path>(MindSpore)
    • msprof:msprof --export=on --output=<output_path>(output points to the path where PROF_{} is located or the export directory)

Analysis Steps

  • Multi-card principle: For multi-card data, by default only sample one card (e.g., Rank0); only when the user explicitly requests "check every card" or "validate card by card" should each card be checked individually.
  • Type-binding principle (must be strictly followed): The basis for determining the data type is thetop-level path given by the user. After determination,only execute the steps corresponding to that type throughout, and do not mix them.
    • If the top-level path ends with [*]_ascend_pt or [*]_ascend_ms → use only framework profiler rules。
    • If the top-level path is the PROF_[*] directory → use only msprof rules。

1. Identify the data type

  • [*]_ascend_pt → framework profiler (PyTorch); multiple subdirectories → multiple cards, single directory → single card
  • [*]_ascend_ms → framework profiler (MindSpore); multiple subdirectories → multiple cards, single directory → single card
  • PROF_[*] → msprof command line; multiple subdirectories → multiple cards, single directory → single card

2. Validate collection status (Stop Check)

  • Framework profiler: Check profiler_info.json or profiler_info_{Rank_ID}.json; if missing, prompt "collection did not Stop normally," terminate, and recommend checking profiler.stop()
  • msprof: Check whether PROF_{}/device_{}/ exists under end_info.{}({} is a device number placeholder); if missing, prompt "collection did not end normally," terminate

3. Parse configuration (framework profiler only)

  • Framework profiler: Call get_profiler_config to read profiler_info.json, focus on profiler_level、with_stack、with_modules、record_shapes、profile_memory。
  • msprof: no need to check configuration, skip this step.

4. Validate parsing status (Parse Check)

  • Framework profiler: Check whether ASCEND_PROFILER_OUTPUT or the corresponding parse output directory; if missing, stop the analysis and ask the user whether to assist with parsing; if agreed, execute offline_parse_pytorch.py(PyTorch) or offline_parse_mindspore.py(MindSpore)。
  • msprof: check whether under PROF_{} there exists the mindstudio_profiler_output directory (that is, the export result of msprof --export=on ); if missing, stop the analysis and ask whether to assist in executing msprof --export=on --output=<path>。
  • After parsing is complete (or the parse result already exists), continue to step 5.

5. Check key deliverables

  • Framework profiler: check according to export_type — Text mode requires trace_view.json、kernel_details.csv; DB mode requires [*]_profiler_[*].db. If missing, warn that it affects Timeline/operator analysis.
  • msprof: check whether PROF_{} contains msprof_[*].db, or whether mindstudio_profiler_output contains msprof_{timestamp}.json、op_summary.csv. If both are missing, warn.

Output strategy

This skill is apre-check,there is no need to output a full report every time:

  • When the user explicitly requests"check data" or "view validation results", output aconcise structured report, in the following format (one line per item; skip if absent):
    【类型】框架 profiler (PyTorch/MindSpore) 或 msprof 命令行采集 | 单卡/多卡
    【状态】valid / invalid / unparsed
    【配置】level、with_stack、profile_memory、采集步数等关键项(仅框架 profiler)
    【缺失】trace_view.json、kernel_details.csv 等(如有)
    【建议】需解析 / 检查 profiler.stop / 无
    【下一步】推荐的分析技能或操作
    
  • Pre-invocation(the user is doing Timeline/operator analysis, etc.):
    • invalid(not Stop) → must inform and terminate
    • unparsed(not parsed) → inform that parsing is required first and ask whether to assist
    • Validation passed → silently proceed to subsequent analysis

Constraints

  • invalid(not properly Stop) must terminate the process
  • unparsed(not parsed) must prioritize guiding parsing, otherwise subsequent tools cannot run