fusion-scope-analyze

Determines operator fusion boundaries and estimates fusion benefit from profiling data.

14|5|Updated Mar 30, 2026
One-click install
npx skills add https://github.com/Ascend/MindIE-SD --skill fusion-scope-analyze-ascend
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: fusion-scope-analyze
Source: https://github.com/Ascend/MindIE-SD/tree/main/.agents/skills/fusion-scope-analyze
Command: npx skills add https://github.com/Ascend/MindIE-SD --skill fusion-scope-analyze-ascend

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires torch, torch_npu, and includes scripts (resource) and references (resource) components.

What problem does it solve? Deciding which operators should be fused into a single kernel—and whether the fusion is worth doing—requires structural rules and benefit estimation before any kernel is written. This Skill judges fusion-unit boundaries and pre-evaluates expected gains from model code plus profiling execution traces, so engineering time is not spent on fusions that cannot pay off. ## Core Features & Use Cases - Boundary determination: Applies construction rules (function boundaries as candidate groups, attention-family operators as hard anchors, Cube-first wrapping of Vec operators, iterative re-fusion, MatMul-family partitioning for MLP/MoE) to decide where a fusion unit starts and ends. - Benefit pre-evaluation: Classifies chains as MTE-saturated, vector-saturated, or vector-constrained using memory_bound and pipe utilization ratios, then applies bandwidth lower bounds, region share, ceiling method, floor-first, and Amdahl checks to produce go/no-go verdicts. - Gated deliverable: Produces a mandatory fusion_scope.md table validated column-by-column by scripts/check_fusion_scope.py, with theory columns computed by scripts/theory_columns.py and device peaks measured by scripts/perf_probe.py. - Use Case: Given kernel_details.csv and op_summary CSVs from a DiT model profile, ask whether the norm/rope chain after attention can be fused into one kernel and receive a boundary proposal plus a quantified benefit range or a rejection reason. ## Quick Start Ask the assistant to analyze whether the operators in your profiled execution sequence can be fused into one kernel and whether the fusion is worth implementing.

Frequently Asked Questions about fusion-scope-analyze

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

FAQPage Schema
How do I decide which operators can be fused into one kernel?

Start from function boundaries in the model code as candidate groups, then partition the execution sequence using norm, rope, and attention operators as anchors. Regions containing only vector operators are prioritized for fusion; when Cube operators appear, the Cube operator wraps following Vec operators until the summed Vec duration reaches the Cube duration or the next Cube appears.

How to estimate whether operator fusion is worth implementing?

Classify the chain using memory_bound (mte2_ratio divided by max of mac_ratio and vec_ratio) and pipe utilization ratios. MTE-saturated chains benefit from fusion because it reduces data movement; vector-saturated chains do not. Then apply bandwidth lower bounds, region share, ceiling method, and Amdahl checks for a go/no-go verdict.

Can attention operators like FlashAttention be fused with neighbors?

No. The attention operator family, including sparse, quantized, and tiled variants such as FlashAttention, is a hard anchor: it cannot be absorbed into a fusion unit and cannot be crossed by one. Fusion boundaries must be drawn around it.

What profiling data is required for fusion benefit analysis?

You need kernel_details.csv with Name, Start Time, Duration, and Task Type columns, plus an op_summary CSV containing PipeUtilization ratio columns (vec, mac, mte2, mte3 ratios and cube_utilization). If the ratio columns are missing or all N/A, the collection is judged unqualified and must be redone before any benefit conclusion.

Why does fusion analysis reject a conclusion when utilization columns are N/A?

Benefit classification depends on the four pipe utilization ratio families; missing or all-N/A columns make classification impossible. The Skill fails closed, directs you to re-collect profiling data with PipeUtilization metrics, and forbids treating N/A as zero or guessing from the execution sequence alone.

What are the limitations of fusion scope analysis?

It only produces fusion unit drafts, benefit verdicts, and rejection reasons. It does not select or prioritize opportunities, write kernels or patterns, perform profiling collection or bottleneck localization, or define acceptance criteria—those belong to adjacent skills in the optimization pipeline.