llm-torch-profiler-analysis

Unified LLM torch-profiler triage skill for `sglang`, `vllm`, `TensorRT-LLM`, and `TokenSpeed`. Use it to inspect an existing `trace.json(.gz)` or profile directory, or to drive live profiling against a running server when supported and return one three-table report with kernel, overlap-opportunity, and fuse-pattern tables.

Install
npx skills add 'https://github.com/sgl-project/sglang/tree/main/.claude/skills/llm-torch-profiler-analysis'
Download bundle ↓
main · a9fb1c3Scanned 2026-09-17

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗
View on GitHub
← Back to SKILL.md

vLLM Torch Compile Fusion Patterns

Refresh: 2026-06-26. Source tree: vLLM origin/main at abc71548ef029132c3316b902207f254a246d593; no new LLM compile-fusion pass was added after 2317682f9 in this refresh. The mainline #40392 MLA RoPE + KV-cache cat fusion is already included below. Recent post-#46735 vLLM changes include runtime / frontend work such as #44800 and #46799, but they do not add a new LLM compile-fusion pass to this inventory.

Use this file when the fuse-pattern table reports split kernels in a trace and you need to decide whether the shape is already covered by vLLM's torch.compile pattern matcher. Treat every row here as an upstream precedent before calling a similar SGLang opportunity novel.

Pass Registration

vLLM registers these passes from vllm/compilation/passes/pass_manager.py through PassConfig.

TogglePassTarget shape
enable_spSequenceParallelismPassall-reduce around residual/norm blocks becomes reduce-scatter, local work, and all-gather
fuse_gemm_commsAsyncTPPassGEMM plus reduce-scatter / all-gather overlap through symmetric-memory collectives
fuse_allreduce_rmsAllReduceFusionPass or ROCm AITER variantall-reduce followed by RMSNorm, optional residual add, optional FP8 / NVFP4 quant; current pass ordering runs AITER add-RMSNorm-pad before this fusion when available
fuse_minimax_qk_normMiniMaxQKNormPassMiniMax Q/K all-reduce plus RMSNorm decode path
fuse_norm_quantRMSNormQuantFusionPassRMSNorm or fused-add-RMSNorm followed by FP8 / FP4 quant
fuse_norm_quant + AITERRocmAiterRMSNormQuantFusionPassROCm AITER RMSNorm / fused-add-RMSNorm followed by AITER or vLLM quant
fuse_act_quantActivationQuantFusionPassSiLU-and-mul followed by FP8 / NVFP4 / block quant
fuse_act_quant + AITERRocmAiterSiluMulFp8GroupQuantFusionPassAITER SiLU-and-mul followed by FP8 group quant
fuse_act_padding + AITERRocmAiterTritonAddRMSNormPadFusionPassAITER fused-add-RMSNorm followed by padding into the next layout
fuse_mla_dual_rms_norm + AITERMLADualRMSNormFusionPassMLA paired Q and KV RMSNorms become fused_mla_dual_rms_norm
fuse_rope_kvcacheRopeKVCacheFusionPassRoPE plus paged KV-cache update, after split cleanup passes
fuse_rope_kvcache_cat_mlaMLARoPEKVCacheCatFusionPassMLA RoPE on q_pe / k_pe plus unified MLA KV-cache update through a fused concat/cache op
fuse_attn_quantAttnQuantFusionPassattention output followed by FP8 / NVFP4 quant
fuse_attn_quantMLAAttnQuantFusionPassMLA attention output followed by FP8 / NVFP4 / FP8 group quant
enable_qk_norm_rope_fusionQKNormRoPEFusionPassQ/K RMSNorm plus RoPE on packed QKV tensors

Pattern Inventory

Source filePattern classesTrace clueReplacement
fusion/allreduce_rms_fusion.pyAllReduceRMSNormPattern, AllReduceFusedAddRMSNormPattern, AllReduceFusedRMSNormStaticQuantFP8Pattern, AllReduceFusedAddRMSNormStaticQuantFP8Pattern, AllReduceFusedRMSNormStaticQuantNVFP4Pattern, AllReduceFusedAddRMSNormStaticQuantNVFP4PatternTP all-reduce directly before RMSNorm, residual-add RMSNorm, or quantflashinfer_trtllm_fused_allreduce_norm with FlashInfer allreduce fusion pattern codes
fusion/rms_quant_fusion.pyRMSNormStaticQuantPattern, FusedAddRMSNormStaticQuantPattern, RMSNormDynamicQuantPattern, FusedAddRMSNormDynamicQuantPattern, RMSNormGroupQuantPattern, FusedAddRMSNormGroupQuantPatternRMSNorm or fused-add-RMSNorm followed by static FP8, dynamic per-token FP8, FP8 group quant, or NVFP4 quant_C.rms_norm_*_quant, _C.fused_add_rms_norm_*_quant, or per-block quant custom op
fusion/rocm_aiter_fusion.pyAiterRMSNormDynamicQuantPattern, AiterFusedAddRMSNormDynamicQuantPattern, AiterRMSFp8GroupQuantPattern, AiterFusedAddRMSFp8GroupQuantPatternAITER RMSNorm/fused-add-RMSNorm followed by AITER or vLLM FP8 quantAITER fused RMSNorm-quant custom ops
fusion/act_quant_fusion.pySiluMulFp8StaticQuantPattern, SiluMulNvfp4QuantPattern, SiluMulBlockQuantPatternSiLU-and-mul activation output immediately quantizedfused activation-plus-quant custom op
fusion/rocm_aiter_fusion.pyAiterSiluMulFp8GroupQuantPatternAITER SiLU-and-mul followed by FP8 group quantAITER act_mul_fused_fp8_group_quant
fusion/rocm_aiter_fusion.pyAddAiterRMSNormPadPatternAITER fused-add-RMSNorm output padded before the next opAITER add-RMSNorm-pad op
fusion/rocm_aiter_fusion.pyMLADualRMSNormPatternMLA Q branch and KV branch each run RMSNormtorch.ops.vllm.fused_mla_dual_rms_norm backed by AITER fused QK RMSNorm
fusion/qk_norm_rope_fusion.pyQkNormRopePatternQ/K RMSNorm, split/getitem reshapes, then RoPE_C.fused_qk_norm_rope
fusion/rope_kvcache_fusion.pyRopeReshapeKVCachePatternRoPE output followed by reshape/cache updatevllm.fused_rope_and_unified_kv_cache_update
fusion/mla_rope_kvcache_cat_fusion.pyMLARoPEKVCacheCatPatternMLA RoPE on q_pe and k_pe flows into unified_mla_kv_cache_updatevllm.fused_rope_unified_mla_kv_cache_update, backed by concat_and_cache_mla_rope_fused
fusion/attn_quant_fusion.pyAttnFp8StaticQuantPattern, AttnNvfp4QuantPatternattention output followed by FP8 static quant or NVFP4 quantbackend attention op with fused output quant when supported
fusion/mla_attn_quant_fusion.pyMLAAttnFp8StaticQuantPattern, MLAAttnNvfp4QuantPattern, MLAAttnFp8GroupQuantPatternMLA attention output followed by static FP8, NVFP4, or FP8 group quantMLA attention op with fused output quant when supported
fusion/minimax_qk_norm_fusion.pyMiniMaxQKNormPatternMiniMax forward_qk: Q/K variance all-reduce divided by TP world size, then RMS applyvllm.minimax_qk_norm_fused / Lamport fused kernel
fusion/sequence_parallelism.pyFirstAllReduceRMSNormPattern, MiddleAllReduceRMSNormPattern, FirstAllReduceRMSNormStaticFP8Pattern, MiddleAllReduceRMSNormStaticFP8Patternall-reduce plus norm block in a full-graph TP modelsequence-parallel reduce-scatter, local norm, all-gather staging
fusion/collective_fusion.pyGEMMReduceScatterPattern, AllGatherGEMMPattern, ScaledMMReduceScatterPattern, AllGatherScaledMMPattern, CutlassScaledMMReduceScatterPattern, AllGatherCutlassScaledMMPattern, FlashInferBMMFP8ReduceScatterPattern, FlashInferAllGatherBMMFP8Patternmatmul / scaled-mm / FlashInfer BMM adjacent to TP collectivessymmetric-memory fused matmul+reduce-scatter or all-gather+matmul

Triage Rules

  • If the trace shows split norm/add/quant, compare first against RMSNormQuantFusionPass, AITER variants, and AllReduceFusionPass.
  • If the trace shows attention output followed by quant kernels, compare against AttnQuantFusionPass or MLAAttnQuantFusionPass, not only handwritten attention kernels.
  • If the trace shows Q/K norm followed by RoPE or cache update, compare QKNormRoPEFusionPass, RopeKVCacheFusionPass, and the MLA-specific MLARoPEKVCacheCatFusionPass; they are separate passes.
  • If the trace is a TP decode trace with visible collectives, check whether enable_sp and fuse_gemm_comms would transform the same region into sequence-parallel or AsyncTP overlap.
  • A missing vLLM compile fusion may be intentional when the graph range, backend support check, dtype, token count, or AITER / FlashInfer availability does not satisfy the pass-specific guard.
Referenced from SKILL.md