What problem does it solve?
Optimizing Triton kernels on Ascend NPUs requires navigating profiler CSVs, pipe utilization metrics, UB memory budgets, and Ascend-specific compiler traps that differ sharply from CUDA Triton. This Skill provides a repeatable profile-diagnose-optimize-verify workflow so kernel performance work on the flash-linear-attention repo is systematic instead of ad hoc.
Core Features & Use Cases
- Generic NPU profiling scripts:
profile_npu.py wraps any workload() callable with torch_npu profiler collection (PipeUtilization, MemoryUB, L2Cache), and analyze_profile.py parses op_statistic and kernel_details CSVs to surface hotspots.
- Bottleneck diagnosis tables: Maps profiler signals (Cube/MAC ratio, Vector ratio, MTE2/MTE3, scalar, UB bandwidth) to concrete bottleneck classes and matching optimization levers such as UB tiling, grid splits, fusion, and G_T_CONTIG gate loading.
- Ascend-specific trap catalog: Documents int32 address overflow, tl.dot left-operand clobber, constexpr DMA-path splitting, make_block_ptr int32 offsets, and the prohibition on num_warps/num_stages, with per-kernel case notes.
- Use Case: A developer notices a Gated DeltaNet backward kernel is slow on Ascend 910. They freeze the baseline, run the generic profiler, identify a stride-HV gather on gate g via high MTE2, apply the G_T_CONTIG host transpose pattern, and verify with the frozen pytest gate plus a synchronized benchmark.
Quick Start
Ask the assistant to profile and optimize a specific Triton-Ascend kernel in the fla repo, for example: profile the causal_conv1d backward kernel on NPU, diagnose its bottleneck, and optimize it following the fla-ascend-performance workflow.