Ascend computation analysis

From kali20gakki/msAgent · View interactive version

Ascend computation analysis is an AI agent skill from the GitHub repository kali20gakki/msAgent. 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,

How to use this skill

Skill file

Ascend Computation Analysis

This skill diagnoses Ascend NPU computation-side performance problems and turns profiling evidence into prioritized optimization directions.

Keep the main workflow evidence-first. Computation problems often have multiple contributing factors, so do not force every case into one root-cause category. Use the failure handbook as a reference after evidence has been collected.

Scope

Use this skill for:

Do not use this skill as the primary workflow for:

Input Priority

Prefer evidence in this order:

  1. ascend_pytorch_profiler_{rank_id}.db
  2. kernel_details.csv
  3. op_statistic.csv
  4. profiler_info.json
  5. step_trace_time.csv or analysis.db / StepTraceTime
  6. msprof-analyze advisor stdout, HTML, or XLSX artifacts

Use a DB-first, CSV-fallback, advisor-cross-check approach.

If both DB and CSV are present, prefer DB for flexible queries and use CSV for quick summaries or schema-compatible fallback. If only CSV is present, continue with degraded analysis instead of blocking.

Tooling Boundary

This skill owns the reasoning workflow:

Use msprof_mcp for stable data access when available, especially:

Do not create narrowly scoped scripts for every issue type. If a reusable capability is missing, prefer direct DB/CSV analysis in the current task and note the missing reusable capability as future msprof_mcp work.

Workflow Overview

Follow this order:

  1. Validate and route input.
  2. Select the analysis target.
  3. Build the computation overview.
  4. Drill down into operators and sequences.
  5. Use advisor as a cross-check.
  6. Consult the failure handbook and fusion rules.
  7. Prioritize findings and produce recommendations.

Do not jump directly to a single Top operator before building the overview. Do not force a single root cause when evidence points to multiple contributing factors.

Step 1: Validate And Route Input

Identify the available data and decide the analysis mode.

Check:

Read profiler_info.json when available and determine profiler level.

Interpret profiler level this way:

Output of this step:

Step 2: Select The Analysis Target

For single-card input, analyze that card directly.

For multi-card input, keep the selection lightweight:

Do not perform full cluster fast/slow rank diagnosis in this skill. Once the target rank is selected, continue as a single-rank computation analysis.

Output of this step:

Step 3: Build The Computation Overview

Before drilling into any operator, build an overview from the selected data source.

Required summaries:

  1. Operator type summary:

total duration, count, average duration, and Top types.

  1. Accelerator core summary:

time share of AI_CORE, AI_VECTOR, AI_CPU, MIX_AIC, MIX_AIV, or equivalent categories.

  1. Top operator summary:

total duration, count, average duration, and max duration.

  1. Stream or task category summary when available:

compute streams, communication streams, auxiliary streams, waits, and OTHER tasks.

The overview should produce observations, not final classification.

Output of this step:

Step 4: Drill Down Into Operators And Sequences

Use two complementary drill-down modes.

Operator Drill-Down

Use this for dominant single operators or operator types.

Inspect when available:

For AI Core operators:

For small-M MatMul/Cube cases:

Sequence Drill-Down

Use this for repeated small operators, no-bound operators, conversion-heavy paths, or fusion opportunities.

For computation-side operator sequences, first group by the same stream_id. Do not infer a compute sequence by globally sorting timestamps across multiple streams; operators that are close in time but run on different streams may be parallel, independent, or connected only through explicit wait/sync edges.

Look for:

Sequence-level findings often produce better recommendations than isolated single-op tuning.

Output of this step:

Step 5: Use Advisor As Cross-Check

If advisor artifacts are not already available and msprof-analyze can be executed, run it on the selected single-card profiling directory:

msprof-analyze advisor all -d <single_card_profiling_path> -o <advisor_output_path>

Advisor execution rules:

Advisor commonly emits both HTML and XLSX artifacts. Prefer XLSX as the primary machine-readable source. Use HTML only when the XLSX file is missing, incomplete, or unreadable.

Use advisor to:

Do not use advisor to:

Relevant computation-related advisor sheets or issue names include:

Advisor reading rules:

Output of this step:

Step 6: Consult References

After operator and sequence drill-down, consult references as needed:

Use them as a handbook for interpreting evidence. A finding may match multiple patterns, and some cases may remain inconclusive.

Step 7: Prioritize Findings And Recommend Next Actions

Prioritize by:

  1. Time impact.
  2. Evidence strength.
  3. Likelihood that the proposed change is actionable.
  4. Risk or invasiveness of the change.

Prefer recommendations framed as next experiments:

Output Format

The final answer should follow this shape:

  1. Summary:

main performance story and confidence.

  1. Evidence:

key timings, counts, ratios, ranks, streams, operators, or advisor findings.

  1. Likely contributing factors:

multiple factors are allowed; avoid forcing one root cause.

  1. Recommendations:

concrete next experiments or code/model changes, ordered by expected impact.

  1. Limitations:

missing fields, degraded profiler level, unavailable advisor sheets, or incomplete rank data.

Avoid:

Degraded Modes

If ideal data is missing, continue with a clear limitation.

Never block the analysis solely because one preferred artifact is missing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.