huawei-cloud-ascend-op-mfu-calculator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHuawei Cloud Ascend Operator MFU Calculator
华为云Ascend算子MFU计算器
Overview
概述
This skill calculates MFU (Machine FLOP Utilization) for operators like matmul/GEMM/FlashAttention on Ascend NPU, providing clear formulas and derivation process.
Architecture: Input Validation → FLOPs Calculation → Achieved TFLOPs/s → MFU Calculation → Result Analysis
Related Skills:
- - Profiling data analysis for operator performance data
huawei-cloud-ascend-profiler-db-explorer
本技能可在Ascend NPU上计算matmul/GEMM/FlashAttention等算子的MFU(机器浮点运算利用率),并提供清晰的公式及推导过程。
架构:输入验证 → FLOPs计算 → 实际TFLOPs/s计算 → MFU计算 → 结果分析
相关技能:
- - 用于算子性能数据的分析型性能剖析工具
huawei-cloud-ascend-profiler-db-explorer
Prerequisites
前提条件
- Python 3.8+ installed
- Basic understanding of FLOPs calculation concepts
- 已安装Python 3.8+
- 具备FLOPs计算概念的基础知识
Usage Scenarios
使用场景
Typical Problem Scenarios:
- Evaluating how well an operator utilizes Ascend NPU compute power
- Comparing performance of different operator implementations
- Identifying optimization opportunities for matrix operations
Typical User Utterances:
- "Calculate MFU for my GEMM operator"
- "What's the machine FLOP utilization for FlashAttention?"
- "Analyze my matmul operator performance efficiency"
典型问题场景:
- 评估算子对Ascend NPU计算能力的利用程度
- 对比不同算子实现的性能
- 挖掘矩阵运算的优化空间
典型用户表述:
- "计算我的GEMM算子的MFU"
- "FlashAttention的机器浮点运算利用率是多少?"
- "分析我的matmul算子的性能效率"
Workflow
工作流程
- Input Collection: Gather operator parameters (matrix dimensions, data types, execution time)
- FLOPs Calculation: Compute theoretical FLOPs for the operation
- Achieved Performance: Calculate achieved TFLOPs/s from execution time
- MFU Calculation: Apply formula MFU = Achieved FLOPs / Peak FLOPs
- Result Analysis: Provide interpretation and optimization suggestions
- 输入收集:收集算子参数(矩阵维度、数据类型、执行时间)
- FLOPs计算:计算该运算的理论浮点运算次数
- 实际性能计算:根据执行时间计算实际TFLOPs/s
- MFU计算:应用公式MFU = 实际浮点运算次数 / 峰值浮点运算次数
- 结果分析:提供结果解读及优化建议
MFU Calculation Formula
MFU计算公式
MFU = (Achieved FLOPs / Peak FLOPs) × 100%
Where:
- Achieved FLOPs = Operation FLOPs / Execution Time
- Peak FLOPs = Hardware-specific peak performance (e.g., Ascend 910B: 256 TFLOPs for FP16)
MFU = (实际浮点运算次数 / 峰值浮点运算次数) × 100%
其中:
- 实际浮点运算次数 = 运算FLOPs / 执行时间
- 峰值浮点运算次数 = 硬件特定的峰值性能(例如:Ascend 910B的FP16峰值为256 TFLOPs)
Reference Documents
参考文档
| Document | Description |
|---|---|
| Ascend 910B Series Technical Specifications | Official Ascend 910B series product specifications |
| MFU Calculation Methodology | Detailed MFU calculation formulas and examples |
| FlashAttention Technical Paper | Original FlashAttention research paper |
| 文档 | 描述 |
|---|---|
| Ascend 910B系列技术规格 | Ascend 910B系列官方产品规格 |
| MFU计算方法 | 详细的MFU计算公式及示例 |
| FlashAttention技术论文 | FlashAttention原始研究论文 |
Enhanced Features
增强功能
Intelligent Bottleneck Diagnoser
智能瓶颈诊断器
- AI-powered bottleneck diagnosis that analyzes profiling data to identify root causes automatically
- Classifies bottlenecks into categories: memory-bound, compute-bound, communication-bound, or operator-fallback
- Provides actionable optimization recommendations with priority ranking
- Includes pattern matching for known performance anti-patterns
- 基于AI的瓶颈诊断,可分析性能剖析数据自动识别根本原因
- 将瓶颈分为以下类别:内存受限、计算受限、通信受限或算子回退
- 提供带有优先级排序的可执行优化建议
- 包含已知性能反模式的模式匹配
Parameter Confirmation
参数确认
| Parameter | Description | Required |
|---|---|---|
| operator | Operator type (matmul/flash_attention/gemm, etc.) | Yes |
| flops | Theoretical FLOPs of the operator | Yes |
| time_ms | Operator execution time (milliseconds) | Yes |
| peak_tflops | Hardware peak computing power (TFLOPS) | Yes |
| device | NPU device type (910B/910, etc.) | No |
| 参数 | 描述 | 是否必填 |
|---|---|---|
| operator | 算子类型(matmul/flash_attention/gemm等) | 是 |
| flops | 算子的理论FLOPs | 是 |
| time_ms | 算子执行时间(毫秒) | 是 |
| peak_tflops | 硬件峰值计算能力(TFLOPS) | 是 |
| device | NPU设备类型(910B/910等) | 否 |