Function Overview
profiling-analysis is a complete Huawei Ascend NPU performance analysis skill set, used to analyze performance data generated by Profiling, automatically identify system performance bottleneck types (computing, communication, dispatch), and provide in-depth analysis capabilities and optimization suggestions.
Core Functions and Execution Workflow
The profiling-analysis skill automatically completes performance analysis through the following workflow:
1. File Scanning and Collection
- Input: Target folder path
- Processing: Recursively traverse the directory, automatically find all
step_trace_time.csvfiles - Validation: Output an error message and terminate when no files are found
2. Performance Data Parsing and Calculation
- Processing: Validate the file structure, extract core metrics such as Computing, Communication, and Free
- Calculation: Calculate the time proportion of each stage (keep 2 decimal places)
- Exception Handling: Skip files that fail to be read, have missing fields, or have a total duration of 0
3. Global Statistics and Bottleneck Determination
- Statistics: Calculate the average time proportion of all files, and identify the file with the highest proportion for each item
- Determination Logic(priority from high to low):
- Dispatch issue (Hostbound): Free time proportion > 20%
- Computing issue (Computing): Computing time proportion > 85%
- Communication issue (Communication): Communication time proportion > 10%
- No obvious bottleneck: all proportions are within the normal range
4. Automatic Invocation of Sub-skills
Based on the determined bottleneck type, automatically invoke the corresponding sub-skill for in-depth analysis:
- Hostbound → Invoke
profiling-analysis-hostboundsub-skill - Computing → Invoke
profiling-analysis-computingsub-skill, execute the complete analysis workflow - Communication → Invoke
profiling-analysis-communicationsub-skill
5. Analysis Report Generation
Output a complete performance analysis report, including:
- File scanning results
- Single-file performance analysis data
- Global statistics and the file with the highest proportion
- Bottleneck determination conclusion
- Sub-skill in-depth analysis results
Execution Workflow Diagram
┌─────────────────────────────────────────────────┐
│ 文件扫描与收集 │
│ 递归查找 step_trace_time.csv 文件 │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ 性能数据解析与计算 │
│ 提取核心指标并计算占比 │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ 全局统计与瓶颈判定 │
│ 计算平均占比并识别瓶颈类型 │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ 子技能自动调用 │
│ 根据瓶颈类型触发对应子技能 │
└─────────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────────┐
│ 分析报告生成 │
│ 输出完整性能分析结果 │
└─────────────────────────────────────────────────┘
Input Parameters
| Parameter Name | Type | Required | Description |
|---|---|---|---|
| input_path | string | Yes | Input path: supports a single Profiling file path, or a folder path containing multiple Profiling files |
Usage Example
Invocation via AI tool (recommended)
调用 skill "profiling-analysis" 分析 "input_path" 中的性能数据
Parameter Description
input_path: Replace with the actual Profiling data folder path- This invocation will automatically complete the full workflow of file scanning, performance analysis, bottleneck determination, and sub-skill invocation
Independent Invocation of Sub-skills (optional)
If you need to directly call a specific sub-skill for in-depth analysis:
# 分析计算瓶颈
调用 skill "profiling-analysis-computing" 分析 "input_path" 中的高耗时算子
# 分析通信瓶颈
调用 skill "profiling-analysis-communication" 分析 "input_path" 中的通信性能
# 分析下发瓶颈
调用 skill "profiling-analysis-hostbound" 分析 "input_path" 中的Host侧问题
Sub-skill Introduction
profiling-analysis includes the following sub-skills, used for different types of performance analysis. When the main skill detects a corresponding bottleneck, it will automatically call the sub-skill for in-depth analysis, with no need for manual execution:
| Sub-skill Name | Function Description | Applicable Scenario |
|---|---|---|
| profiling-analysis | Main analysis skill, identifies the type of performance bottleneck | First-time analysis of Profiling data, quickly locating the main bottleneck |
| profiling-analysis-computing(.\profiling-analysis-computing\SKILL.md) | Computation bottleneck analysis, including: - Screening of high-time-consuming operators (Top-N operators) - Operator performance data pivot table analysis - Shape parsing and optimization suggestions for key operators (such as the MatMul series) | When the computation proportion is too high, conduct in-depth analysis of the specific high-time-consuming operators and their performance characteristics |
| profiling-analysis-communication(.\profiling-analysis-communication\SKILL.md) | Communication bottleneck analysis, analyzing collective communication performance | When the communication proportion is too high, analyze the performance of communication operations |
| profiling-analysis-hostbound(.\profiling-analysis-hostbound\SKILL.md) | Dispatch bottleneck analysis, analyzing Host-side performance issues | When the idle proportion is too high, analyze Host-side dispatch issues |
Supported Data Formats
step_trace_time.csv: Contains time proportion information such as computation, communication, and idleop_statistic.csv: Contains operator execution statisticskernel_details.csv: Contains detailed execution information of operator kernelsop_summary.csv: Contains operator execution summary informationanalysis.db: Profiling database file
Installation and Dependencies
- Python 3.8+
- Dependencies: pandas, numpy, matplotlib (optional)