model-compute-simulation

Simulates operator-level compute flow and estimates FLOPs and MFU for LLM serving configurations.

783|67|Updated Apr 1, 2026
One-click install
npx skills add https://github.com/BBuf/AI-Infra-Auto-Driven-SKILLS --skill model-compute-simulation
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: model-compute-simulation
Source: https://github.com/BBuf/AI-Infra-Auto-Driven-SKILLS/tree/main/skills/model-compute-simulation
Command: npx skills add https://github.com/BBuf/AI-Infra-Auto-Driven-SKILLS --skill model-compute-simulation

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

It answers compute-level questions about LLM serving—operator order, tensor dimensions, per-op FLOPs, and MFU—without requiring a full profiling run, and validates static estimates against real torch profiler traces.

Core Features & Use Cases

  • Static compute simulation: Builds the per-layer operator sequence with tensor shapes and FLOPs for indexed models (DeepSeek-V3/V4, Qwen3, Kimi-K2, MiniMax-M2/M3, GLM-5) under configurable batch size, sequence length, TP/DP/EP, GPU, and dtype.
  • MFU estimation: Computes overall, per-layer, per-operator, and per-kernel MFU from measured latency, with fp8 peak-FLOPS correction for fp8 kernels and GPU specs for H20, H100, H200, and B200.
  • Trace validation: Extracts the real operator flow from torch profiler traces (record_shapes=True) and compares it against the static template, escalating to SGLang/vLLM/TensorRT-LLM source code when traces are insufficient.
  • Use Case: Given a decode serving shape for Qwen3-235B-A22B on 8 H20 GPUs with a measured 15ms forward pass, produce the full operator table, total FLOPs, and kernel-level MFU breakdown to identify the dominant compute bottleneck.

Quick Start

Ask the agent to simulate the compute flow and MFU for your model, for example: run a compute simulation for Qwen3-235B-A22B decode with batch size 1, TP 8, EP 8 on H20 GPUs in bf16 with a measured latency of 15 ms.

Frequently Asked Questions about model-compute-simulation

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

FAQPage Schema
How do I estimate MFU for an LLM serving configuration?▼

Run the simulator with your model name, batch size, sequence length, TP/EP settings, GPU type, dtype, and measured forward-pass latency via --measured-ms. MFU is computed as theoretical minimum time divided by measured time, using peak FLOPS from the GPU specs table.

How do I compute per-kernel MFU from a profiler trace?▼

Extract per-kernel durations from a torch profiler trace into JSON, then pass it with --kernel-flow to get a kernel-level MFU table mapping each kernel to its operator, FLOPs, and MFU. Kernels in moe and gemm_fp8 categories use the fp8 peak FLOPS denominator.

Which models and GPUs does the compute simulator support?▼

The config index covers DeepSeek-V3/V4-Flash, Qwen3-235B-A22B, Qwen3.6-35B-A3B, Qwen3.8-27B, Kimi-K2/K2.5, MiniMax-M2/M3, and GLM-5. GPU specs include H20, H100 SXM 80GB, H200 SXM 141GB, and B200 SXM 180GB, with aliases like h100 or b200.

Can I use the simulator if my model is not in the config index?▼

Not directly. You must provide the model's config.json so its parameters can be verified or added to model-config-index.json before running estimates, since the architecture parameters determine the entire operator sequence.

Why does trace extraction fail to compute FLOPs for some operators?▼

FLOPs require Input Dims in the trace, which only exist when the profiler runs with record_shapes=True. CUDA Graph replay also omits per-iteration cpu_op events, so eager-mode traces are recommended for full coverage.

What are the limitations of trace-based compute flow extraction?▼

Traces show post-TP-split dimensions rather than full-model shapes, scope attribution degrades without with_stack=True, and compiled or graph-replayed kernels may lack shape data. The documented fallback is reading the model's forward() in SGLang, vLLM, or TensorRT-LLM source.