model-infer-perf-breakdown

Breaks down NPU kernel profiling data into per-layer component performance reports.

Updated Sep 15, 2026
One-click install
npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill model-infer-perf-breakdown-wangwindow
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: model-infer-perf-breakdown
Source: https://github.com/WangWindow/CANN-BatchMatMulMaxsum/tree/main/.agents/skills/model-infer-perf-breakdown
Command: npx skills add https://github.com/WangWindow/CANN-BatchMatMulMaxsum --skill model-infer-perf-breakdown-wangwindow

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? NPU profiling output (kernel_details.csv) is a flat list of thousands of kernels with no model structure attached, making it hard to see which attention/FFN/MoE layer is slow or jittery. This Skill slices the kernel sequence into component instances based on the user's model description, buckets operators into semantic clusters, and produces a single-page HTML report of wall/bubble time medians and outlier layers. ## Core Features & Use Cases - Structure-aware breakdown: Splits a single-step kernel sequence into component instances (attn/ffn/moe/mtp) using user-acked stream samples, with hard warnings that must be reviewed before proceeding. - Cluster statistics and jitter detection: Groups operators inside each component by user-defined rules, computes wall_ms/bubble_ms medians, detects outlier layers, and renders a single-page HTML report plus per-component CSV/trace splits. - Incremental reuse and run comparison: Reuses structure and cluster specs across profiling runs via a small/medium/large change classification, and compares multiple runs in a history HTML table with delta percentages. - Use Case: Given a decode-phase profile of an MoE model, identify that layer 17's MoE cluster has abnormally high wall time and that a specific auxiliary stream is temporally displaced, then drill into that layer's sliced CSV for root-cause analysis. ## Quick Start Ask the agent to break down your NPU profiling results by providing the kernel_details.csv and trace_view.json paths, your model script files, and a description of the model's layer structure.

Frequently Asked Questions about model-infer-perf-breakdown

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I break down NPU kernel profiling data by model layer?

Provide kernel_details.csv, trace_view.json, and your model scripts, then describe the model structure (phases, layers, components). The Skill extracts one stable step, matches stream samples to detect component instances, and renders per-cluster wall/bubble medians in an HTML report.

What inputs are required for Ascend NPU profiling analysis?

kernel_details.csv and trace_view.json from torch_npu.profiler or msprof, plus the model's modeling scripts and a chosen phase/rank when multiple devices exist. Missing model scripts or unconfirmed phase/device selection aborts the workflow before any parsing.

Can I reuse analysis results when profiling a modified model?

Yes. The Skill diffs the new profile against the previous run and classifies the change as small, medium, or large. Small changes reuse all specs, medium changes re-ack samples and incrementally extend cluster rules, and large changes rerun the structure dialogue.

Does the analysis work without theoretical performance data?

Yes. The theoretical performance step is optional and disabled by default; the theory median column simply shows a dash when the external operator-theoretical-perf skill is unavailable. All structure detection, clustering, and jitter analysis proceed normally.

Why does the render step fail with an unmatched operators error?

Rendering aborts when compute-core unmatched operators exceed 5 percent, because large unmatched compute segments indicate missing components or incomplete cluster rules. Only communication, sampling, embedding, or IO leftovers may be explicitly accepted with a flag.

What are the limitations of sample-driven layer detection?

Every expected component needs a user-acknowledged stream sample with exactly one primary stream, and hard or ambiguous warnings block output until the user reviews each one. It cannot guess structure silently when samples are missing or mismatched.