huawei-cloud-ascend-op-mfu-calculator

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Huawei 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:
  • huawei-cloud-ascend-profiler-db-explorer
    - Profiling data analysis for operator performance data
本技能可在Ascend NPU上计算matmul/GEMM/FlashAttention等算子的MFU(机器浮点运算利用率),并提供清晰的公式及推导过程。
架构:输入验证 → FLOPs计算 → 实际TFLOPs/s计算 → MFU计算 → 结果分析
相关技能:
  • huawei-cloud-ascend-profiler-db-explorer
    - 用于算子性能数据的分析型性能剖析工具

Prerequisites

前提条件

  1. Python 3.8+ installed
  2. Basic understanding of FLOPs calculation concepts
  1. 已安装Python 3.8+
  2. 具备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

工作流程

  1. Input Collection: Gather operator parameters (matrix dimensions, data types, execution time)
  2. FLOPs Calculation: Compute theoretical FLOPs for the operation
  3. Achieved Performance: Calculate achieved TFLOPs/s from execution time
  4. MFU Calculation: Apply formula MFU = Achieved FLOPs / Peak FLOPs
  5. Result Analysis: Provide interpretation and optimization suggestions
  1. 输入收集:收集算子参数(矩阵维度、数据类型、执行时间)
  2. FLOPs计算:计算该运算的理论浮点运算次数
  3. 实际性能计算:根据执行时间计算实际TFLOPs/s
  4. MFU计算:应用公式MFU = 实际浮点运算次数 / 峰值浮点运算次数
  5. 结果分析:提供结果解读及优化建议

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

参考文档

DocumentDescription
Ascend 910B Series Technical SpecificationsOfficial Ascend 910B series product specifications
MFU Calculation MethodologyDetailed MFU calculation formulas and examples
FlashAttention Technical PaperOriginal 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

参数确认

ParameterDescriptionRequired
operatorOperator type (matmul/flash_attention/gemm, etc.)Yes
flopsTheoretical FLOPs of the operatorYes
time_msOperator execution time (milliseconds)Yes
peak_tflopsHardware peak computing power (TFLOPS)Yes
deviceNPU device type (910B/910, etc.)No
参数描述是否必填
operator算子类型(matmul/flash_attention/gemm等)
flops算子的理论FLOPs
time_ms算子执行时间(毫秒)
peak_tflops硬件峰值计算能力(TFLOPS)
deviceNPU设备类型(910B/910等)