huawei-cloud-ascend-op-mfu-calculator — скилл для Claude Code
Скилл huawei-cloud-ascend-op-mfu-calculator для Claude Code рассчитывает MFU операторов на Ascend NPU. Он также разбирает данные профилировщика и помогает найти узкое место.
MIT 270 установок ★ 59 обновлён 2026-11-12
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-ascend-op-mfu-calculator -a claude-codeЧто делает huawei-cloud-ascend-op-mfu-calculator
Скилл считает FLOPs операции, достигнутую производительность в TFLOPs/s и MFU относительно пиковой производительности конкретной модели Ascend. Поддерживаются сценарии с matmul, GEMM и FlashAttention.
Скилл также запускает локальный анализатор scripts/bottleneck_diagnoser.py: тот читает CSV профилировщика Ascend, классифицирует узкие места и выдаёт ранжированный отчёт с рекомендациями. Нужен Python 3.8 или новее. Единицы времени критичны: смешение миллисекунд и микросекунд меняет результат примерно в 1000 раз, поэтому при неоднозначности нужно подтвердить единицу.
Какие задачи решает
- рассчитать MFU для GEMM по FLOPs и времени выполнения
- сравнить эффективность двух реализаций оператора
- найти узкое место в CSV профилировщика Ascend
- получить достигнутые TFLOPs/s и загрузку вычислений для оператора
Примеры запросов агенту
- Рассчитай MFU моего GEMM: FLOPs — <значение>, время — <значение> мс, пиковая производительность — <значение> TFLOPs/s.
- Разбери
OpBasicInfo.csvи определи узкие места операторов. - Проанализируй производительность моего FlashAttention по данным профилировщика.
Как установить huawei-cloud-ascend-op-mfu-calculator
1Через Skills CLI (Vercel)
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-ascend-op-mfu-calculator -a claude-code2Вручную: положить файлы
~/.claude/skills/huawei-cloud-ascend-op-mfu-calculator/SKILL.mdПапка скилла целиком; для одного проекта — .claude/skills/huawei-cloud-ascend-op-mfu-calculator/
1Через Skills CLI (Vercel)
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-ascend-op-mfu-calculator -a codex2Вручную: положить файлы
.agents/skills/huawei-cloud-ascend-op-mfu-calculator/SKILL.mdДля всех проектов — ~/.agents/skills/
1Через Skills CLI (Vercel)
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-ascend-op-mfu-calculator -a cursor2Вручную: положить файлы
.cursor/skills/huawei-cloud-ascend-op-mfu-calculator/SKILL.mdCursor читает и .agents/skills/, и .claude/skills/
1GitHub CLI
gh skill install huaweicloud/huaweicloud-skills skills/ai/modelarts/huawei-cloud-ascend-op-mfu-calculator2Вручную: положить файлы
.github/skills/huawei-cloud-ascend-op-mfu-calculator/SKILL.md1Через Skills CLI (Vercel)
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-ascend-op-mfu-calculator -a gemini-cli2Командой платформы
gemini skills install https://github.com/huaweicloud/huaweicloud-skills --path skills/ai/modelarts/huawei-cloud-ascend-op-mfu-calculatorВручную: положить файлы
.devin/skills/huawei-cloud-ascend-op-mfu-calculator/SKILL.mdСтарый путь .windsurf/skills/ тоже читается
Через Skills CLI (Vercel)
npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-ascend-op-mfu-calculator -a opencodeClaude.ai
Упакуйте папку в zip и загрузите в Settings → Capabilities → Skills
По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов
Вопросы о huawei-cloud-ascend-op-mfu-calculator
Как установить huawei-cloud-ascend-op-mfu-calculator в Claude Code?
Выполните npx skills add huaweicloud/huaweicloud-skills --skill huawei-cloud-ascend-op-mfu-calculator -a claude-code. Файл скилла появится в ~/.claude/skills/huawei-cloud-ascend-op-mfu-calculator/SKILL.md.
Что делает huawei-cloud-ascend-op-mfu-calculator?
Считает FLOPs, достигнутые TFLOPs/s и MFU оператора для Ascend NPU. Также анализирует CSV профилировщика и классифицирует узкие места.
Почему важно указывать единицу времени выполнения?
Расчёт чувствителен к единице: смешение миллисекунд и микросекунд меняет MFU примерно в 1000 раз. Для длительности из профилировщика в микросекундах нужно передать time_us или перевести значение в миллисекунды.
Исходный текст
SKILL.md · MIT
--- name: huawei-cloud-ascend-op-mfu-calculator description: | Calculate MFU (Machine FLOP Utilization) for operators like matmul/GEMM/FlashAttention on Ascend NPU, providing clear formulas and derivation process Use when the user wants to: (1) calculate MFU for matrix operations, (2) analyze operator performance efficiency, (3) bottleneck diagnosis from Ascend profiling data, (4) optimize operator implementation Triggers include: "MFU", "machine flop utilization", "operator FLOPs", "matmul performance", "GEMM efficiency", "Ascend MFU", "算子MFU", "算力利用率", "矩阵乘效率", "GEMM性能", "FlashAttention性能", "瓶颈诊断", "bottleneck" tags: [Ascend, MFU, operator, performance] compatibility: - Python3 >= 3.8 allowed-tools: - python3 --- # Huawei Cloud Ascend Operator MFU Calculator ## 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 skills may provide operator performance data (execution time and memory traffic) used by this skill's MFU calculation and bottleneck diagnosis. **Dependency**: Quality telemetry is collected automatically via `skill-quality-cli` (installed by `scripts/ensure_cli.sh` if absent). ## Prerequisites 1. Python 3.8+ installed 2. Basic understanding of FLOPs calculation concepts - **`skill-quality-cli`** — ensured by `bash scripts/ensure_cli.sh` (idempotent, skips if present) - Upgrade: run `skill-quality-cli upgrade` manually (no auto-upgrade) - Disable telemetry report: set `SKILL_QUALITY_REPORT=0` > All `hcloud` commands in this skill are wrapped with `skill-quality-cli run` for telemetry. No manual action required. ## 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" ## 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 ## MFU Calculation Formula MFU = (Achieved FLOPs / Peak FLOPs) × 100% **Where**: - Achieved FLOPs = Operation FLOPs / Execution Time - Peak FLOPs = Hardware-specific peak performance. Use the **per-model** FP16/BF16 peak values below — do NOT use a single generic value like 256 TFLOPs. | Ascend Model | FP16/BF16 Peak (TFLOPs/s) | |--------------|---------------------------| | 910B1 | ≈ 378.88 | | 910B2 | ≈ 353.89 | | 910B3 | ≈ 294.91 | | 910B4 | ≈ 270 | ## Reference Documents | Document | Description | | -------- | ----------- | | [Ascend 910B Series Technical Specifications](https://e.huawei.com/cn/products/computing/ascend-910) | Official Ascend 910B series product specifications | | [MFU Calculation Methodology](references/mfu-calculation-methodology.md) | Detailed MFU calculation formulas and examples | | [FlashAttention Technical Paper](https://arxiv.org/abs/2205.14135) | Original FlashAttention research paper | ## Enhanced Features ### Intelligent Bottleneck Diagnoser A rule-based bottleneck diagnoser (`scripts/bottleneck_diagnoser.py`) that analyzes Ascend profiling CSV data (e.g. `OpBasicInfo.csv` from msprof) and automatically classifies each operator's bottleneck: - **memory-bound** — achieved memory bandwidth utilization is close to the hardware peak - **compute-bound** — AI Core (compute) utils are the limiting resource - **communication-bound** — collective communication operators (HCCL AllReduce/AllGather, etc.) dominate - **operator-fallback** — the operator ran on AI CPU / CPU instead of an AI Core kernel It computes per-operator achieved TFLOPS, memory bandwidth and compute utilization, then returns a ranked report (priority P0/P1/P2) with concrete optimization recommendations. ```bash skill-quality-cli run --skill-name huawei-cloud-ascend-op-mfu-calculator -- python3 scripts/bottleneck_diagnoser.py --csv OpBasicInfo.csv --peak-tflops 294.91 --peak-memory-bw 1200 ``` > Column matching is tolerant of the exact msprof header names (e.g. `Task Duration(us)`, `AI Core Time(us)`, `Memory Read Bytes`, `Memory Write Bytes`). If a column is absent, the related signal is skipped and classification falls back to the remaining signals. ## Core Commands The skill is a pure calculation/diagnosis skill (no Huawei Cloud CLI mutation): everything is computed locally with Python 3.8+. | Command | Purpose | |---------|---------| | MFU calculation | Compute FLOPs, achieved TFLOPs/s and MFU with the formulas in [MFU Calculation Methodology](references/mfu-calculation-methodology.md); use per-model peak TFLOPs from the table above and confirm the execution-time unit (ms vs us) | | `python3 scripts/bottleneck_diagnoser.py --csv <profiling.csv> [--peak-tflops <TFLOPs>] [--peak-memory-bw <GB/s>]` | Auto-classify operator bottlenecks from Ascend profiling CSV | ## 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 | | time_us | Operator execution time (microseconds) — alternative to `time_ms` | No | | peak_tflops | Hardware peak computing power (TFLOPS); use the per-model table above | Yes | | device | NPU device type (910B1/910B2/910B3/910B4/910, etc.) | No | ### Time Unit Handling (ms / us) MFU is sensitive to the execution-time unit — mixing ms and us changes the result by ~1000×. Follow these rules: - **`time_ms` is the canonical input (milliseconds).** - If the user provides the duration from an Ascend profiler (e.g. profiling CSV columns `Task Duration(us)`), that value is in **microseconds (us)** — convert it before calculating: - `time_ms = time_us / 1000` - Achieved TFLOPs/s = `flops / (time_us × 1e-6) / 1e12` (equivalently `flops / (time_ms × 1e-3) / 1e12`) - Alternatively pass `time_us` as the input parameter and let the calculation convert internally. - Always ask the user to confirm the unit when it is ambiguous, and state the unit in the final MFU result.
© huaweicloud · MIT · huaweicloud/huaweicloud-skills