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

Overlap Catalog

This catalog is the overlap-only companion to references/fuse-overlap-catalog.md.

This revision is intentionally kernel-scoped. Keep rows here only when the overlap is visible in a profiler as GPU kernels, collective kernels, or streamed kernel families. Host-only scheduler, event-loop, executor, offload, and load-path overlaps are intentionally excluded.

Use it like this:

  1. Start from the overlap-opportunity table.
  2. Match visible kernel windows, collective windows, or stream-level overlap against the rows below.
  3. If a match exists in the mainline sections, report it as an existing overlap family that is missing, disabled, regressed, or unsupported on the current backend.
  4. If a match exists only in the PR-backed / in-flight section, report it as an upstream overlap pattern, not a novel idea.
  5. Only call an overlap opportunity "new" when no row in this file or fuse-overlap-catalog.md fits.

The vLLM-origin sections below are comparative references. They are not necessarily present in the checked-out sglang tree, but they should still be treated as upstream or analogous kernel-overlap families before labeling an overlap opportunity as novel.

Refresh note 2026-06-26: rechecked official main heads for SGLang 8524678889485801e7a4a12d62015be0c68f7a90, vLLM abc71548ef029132c3316b902207f254a246d593, TensorRT-LLM 0722c5f47d2cae69ac1a237da51e550dd214532c, and TokenSpeed 5aedf69d6b476baa65571011de6ea60fd5a238a8, then added the first TokenSpeed-origin communication-fusion row. Closed-unmerged SGLang #22410 and FlashInfer #2840 were removed from the PR-backed sections. SGLang #21877, FlashInfer #2720, and vLLM #35968 / #39301 remain useful upstream overlap references as of this refresh.

1. LLM / SRT kernel-overlap families

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
Single-batch overlap (SBO)MoE combine, down-gemm, shared-expert work in nearby two-stream windowspython/sglang/srt/batch_overlap/single_batch_overlap.pycombine vs down-gemm overlap, combine vs shared-expert overlap, one-stream dispatch+shared overlap, explicit SM partitioning and eventsIf exposed MoE combine sits near neighboring compute, classify it against SBO before calling it new overlap.
Q and K normalization on different streamsQ-side norm and K-side norm on different streamspython/sglang/srt/models/utils.py::apply_qk_normpython/sglang/srt/models/qwen3.pypython/sglang/srt/models/qwen3_next.pypython/sglang/srt/models/qwen3_5.pyQ stays on current stream, K can run on alt_stream in capture modeTreat split Q / K norm as an existing overlap family when alt_stream is already wired.
DeepSeek shared-expert / routed-expert overlapshared-expert GEMMs near DeepEP dispatch / combinepython/sglang/srt/models/deepseek_v2.pypython/sglang/srt/batch_overlap/single_batch_overlap.pyshared experts on alt_stream, overlap with dispatch / combine and down-gemm, Blackwell-specific env gatingThis is an established routed-vs-shared branch overlap pattern, not a novel idea.
Llama4 shared branch vs routed branch overlapshared expert branch plus routed MoE branch as adjacent windowspython/sglang/srt/models/llama4.pyshared expert on current stream, router + topk + routed experts on alt_streamUse Llama4 as the first precedent for branch-level overlap in similar sparse models.
ExaoneMoE shared experts vs router experts overlapshared expert output and router-expert output form a two-branch windowpython/sglang/srt/models/exaone_moe.py::forward_normal_dual_streamshared experts on current stream, router + routed experts on alt_stream, explicit join before combineThis is an existing dual-stream MoE overlap family.
Grok residual-MoE branch overlapdense MLP and block-sparse MoE branches in parallelpython/sglang/srt/models/grok.py::moe_with_rmoedense MLP on current stream, MoE on alt_stream, fused dual residual RMSNorm around boundariesTreat exposed Grok branch overlap as an existing pattern.
NSA dual-stream overlapQ-proj, K-proj, RoPE, cache-store, quantization in tight two-stream windowspython/sglang/srt/layers/attention/nsa/nsa_indexer.pyQ / K projection split, RoPE split, cache-store vs quantization overlapNSA already contains several dual-stream overlap precedents.
MoriEP async dispatch / combine comm streamMoriEP_comm_streamdispatchcombinedone_eventpython/sglang/srt/layers/moe/token_dispatcher/moriep.pyMoriEP can submit dispatch and combine onto a dedicated communication stream and synchronize only through eventsTreat MoriEP comm / compute interleave as an existing MoE overlap family.
Generic alt_stream overlap familiesalt_stream plus explicit wait_stream / with torch.cuda.stream(...)qwen2_moe.pyqwen3_moe.pyglm4_moe.pybailing_moe.pyllada2.pygrok.pyolmo2.pystep3p5.pylongcat_flash.pyfalcon_h1.pymodel-specific overlap on attention prep, MoE branches, or cache-storeSearch these families before designing a new overlap scheme from scratch.

2. Staging / communication kernel-overlap families

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
Decode scatter on dedicated scatter_streamscatter_stream_scatter_streampython/sglang/srt/disaggregation/common/staging_handler.pystaging scatter kernels are submitted to a dedicated stream so the decode thread does not block on the main forward streamTreat decode-side staging scatter windows as an existing overlap pattern.
Staging-buffer fused gather / scatter kernels_fused_gather_to_staging_kernel_fused_scatter_from_staging_kernelpython/sglang/srt/disaggregation/common/staging_buffer.pyTriton kernels gather KV slices into contiguous staging memory and scatter them back to KV cacheIf heterogeneous-TP staging shows many small copy kernels, compare against this existing fused-plus-overlap family first.

3. VLM / diffusion kernel-overlap families

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
Vision QK norm with aux streamvision-side QK norm or norm-like kernels before attentionpython/sglang/srt/layers/attention/vision.pyvision QK normalization can call shared apply_qk_norm(...), with K-side work on aux_streamIf vision QK prep is split, first check this existing aux-stream path.
ViT CUDA graph disables vision aux streamexpected vision overlap is absent under ViT graphpython/sglang/srt/models/internvl.pypython/sglang/srt/layers/attention/vision.pypython/sglang/srt/environ.py::SGLANG_VIT_ENABLE_CUDA_GRAPHvision aux_stream is intentionally disabled when ViT CUDA graph is onMissing vision overlap may be intentional, not a regression.
Ulysses sequence-parallel attentionexposed all_to_all around attention blockspython/sglang/multimodal_gen/runtime/layers/attention/layer.pypython/sglang/multimodal_gen/runtime/distributed/communication_op.pyhead / sequence redistribution before and after attentionTreat sequence-parallel all-to-all as an existing distributed attention family.
USP attention with all-to-all and ring attentionall_to_all, ring-attention comm, head / sequence reshardspython/sglang/multimodal_gen/runtime/layers/attention/layer.py_usp_input_all_to_all(...), _usp_output_all_to_all(...), ring_attn(...)This is the primary existing overlap / comm family for many diffusion models.
Turbo-layer async all-to-all pipeliningpipelined A2A windows with explicit waits on a comm streampython/sglang/multimodal_gen/runtime/layers/attention/turbo_layer.pylooped all_to_all_single(..., async_op=True) plus staged postprocess on a comm streamTreat exposed turbo A2A windows as an existing pipelined overlap pattern.
TorchInductor compute / communication reordercompiled traces with compute and comm partially interleavedpython/sglang/multimodal_gen/runtime/pipelines_core/stages/denoising.pypython/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/mova.pytorch._inductor.config.reorder_for_compute_comm_overlap = TrueExisting compile-time reordering may already explain partial overlap in diffusion traces.
Dual-stream diffusion modelstwo nearby compute branches inside one DiT / UNet blockpython/sglang/multimodal_gen/runtime/models/dits/hunyuan3d.pyuse_dual_stream = TrueTreat dual-branch diffusion execution as an existing overlap family.

4. PR-backed / in-flight kernel-overlap families

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
PR #21877 fused down-GEMM + combine superseding SBOenable_fused_grouped_gemm_combinecombinedown_gemmPR #21877python/sglang/srt/server_args.pypython/sglang/srt/layers/moe/token_dispatcher/deepep.pyFused combine eliminates the standalone combine window, so SBO is intentionally disabled when this path is onIf the trace discussion is about combine overlap, first classify it as this upstream fused-overlap family.

5. FlashInfer kernel-overlap families

These rows are comparative references from flashinfer. Use them when a trace looks like an upstream FlashInfer overlap family even if the current sglang checkout only calls part of that implementation.

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
FlashInfer PDL launch-overlap familyenable_pdllaunch_with_pdlcudaGridDependencySynchronizecudaTriggerProgrammaticLaunchCompletiontrigger_completion_at_end=Falseallreduce_fusionflashinfer/norm/__init__.pyflashinfer/activation.pyflashinfer/rope.pyflashinfer/comm/allreduce.pyflashinfer/comm/trtllm_ar.pyFlashInfer uses Programmatic Dependent Launch broadly, and the allreduce path can further advance completion so the next PDL-aware kernel overlaps on the same streamTreat tight same-stream dependent windows and allreduce-followed-by-kernel windows as one existing FlashInfer launch-overlap family first.
FlashInfer CuTeDSL MoE aux-stream async-memset overlapaux_streammain_eventmemset_eventuse_async_memsetflashinfer/fused_moe/cute_dsl/fused_moe.pyPreallocated MoE output is zeroed on an auxiliary CUDA stream while GEMM1 runs on the main stream, then both streams join before finalizeTreat GEMM1 vs output-zero windows as an existing FlashInfer multi-stream overlap family.
FlashInfer green-context SM partition overlapsplit_device_green_ctxsplit_device_green_ctx_by_sm_countgreen_ctxflashinfer/green_ctx.pyCUDA green contexts partition SMs and create dedicated streams for concurrent kernel families on separate SM slicesTreat SM-partitioned concurrency as an existing FlashInfer overlap mechanism, not a novel scheduler idea.

6. FlashInfer PR-backed / in-flight kernel-overlap families

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
PR #2720 PDL runtime-API migrationcudaGridDependencySynchronizecudaTriggerProgrammaticLaunchCompletioninline PTXPR #2720include/flashinfer/comm/trtllm_allreduce_fusion.cuhinclude/flashinfer/pos_enc.cuhRepo-wide migration preserves the existing PDL overlap family while replacing inline PTX with CUDA runtime APIs across norm, RoPE, attention, and MoE codepathsTreat PDL-looking launch groups as an upstream FlashInfer overlap family even when implementation details differ across revisions.

7. TensorRT-LLM-origin kernel-overlap families

These rows are comparative references from TensorRT-LLM. Current mainline TensorRT-LLM overlap rows are mostly explicit auxiliary-stream rewrites in AutoDeploy rather than same-stream PDL windows.

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
TensorRT-LLM multi-stream MLA attentionmulti_stream_mla_attnrecord_event_passthrough_auxwait_eventtensorrt_llm/_torch/auto_deploy/transform/library/multi_stream_attn.pytensorrt_llm/_torch/auto_deploy/utils/multi_stream_utils.pyAutoDeploy rewrites MLA Q/KV forks so the KV projection runs on an auxiliary stream while the Q path stays on the caller streamTreat exposed Q-branch vs KV-branch overlap as an existing TensorRT-LLM multi-stream family first.
TensorRT-LLM multi-stream MoE shared-vs-routed overlapmulti_stream_moebegin_aux_stream_passthroughend_aux_stream_passthroughwait_aux_stream_passthroughmlir_elementwise_fusionpiecewise cudagraphcaller_stream.synchronize()tensorrt_llm/_torch/auto_deploy/transform/library/multi_stream_moe.pytensorrt_llm/_torch/auto_deploy/utils/multi_stream_utils.pyShared-expert work is moved to an auxiliary stream while routed-expert MoE work remains on the main stream and rejoins at the merge node; the same family includes synchronization rules for MLIR-fused kernels and piecewise cudagraph replayTreat shared-expert vs routed-expert windows, including altered behavior under MLIR / piecewise graph modes, as an existing TensorRT-LLM branch-overlap family.
TensorRT-LLM multi-stream FP8 GEMM fork parallelismmulti_stream_gemmtrtllm_finegrained_fp8_linearrecord_event_passthrough_auxtensorrt_llm/_torch/auto_deploy/transform/library/multi_stream_gemm.pytensorrt_llm/_torch/auto_deploy/utils/multi_stream_utils.pyCompiler pass identifies fork points with multiple FP8 linears and moves the largest GEMM to the auxiliary stream so sibling GEMMs overlapTreat sibling FP8 linear branches as an existing TensorRT-LLM overlap family before designing a new stream split.

8. TokenSpeed-origin kernel-overlap families

These rows are comparative references from lightseekorg/tokenspeed. Use them when the trace is from TokenSpeed or from a vLLM/TokenSpeed hybrid deployment.

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
TokenSpeed allreduce / communication fusionenable_allreduce_fusioncomm_fusioncomm_fusion_max_num_tokensallreducedocs/configuration/server.mdpython/tokenspeed/runtime/distributed/comm_backendTokenSpeed exposes runtime knobs for communication fusion and token-count gating, so all-reduce windows may be a disabled or shape-gated TokenSpeed pathTreat split all-reduce + compute windows in TokenSpeed traces as a comm-fusion eligibility question before calling it a novel overlap opportunity.

9. vLLM-origin kernel-overlap families

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
vLLM-origin AsyncTP GEMM + collective overlapfuse_gemm_commsfused_matmul_reduce_scatterfused_all_gather_matmulvllm/compilation/passes/fusion/collective_fusion.pydocs/design/fusions.mdAsyncTP overlaps GEMM with reduce-scatter / all-gather via symmetric-memory collectivesTreat GEMM+comm windows as a clear vLLM-origin overlap precedent first.
vLLM-origin Sequence Parallelism stagingenable_spReduceScatterAllGatherSequenceParallelismPassvllm/compilation/passes/fusion/sequence_parallelism.pydocs/design/fusions.mdSequence-parallel rewrites all-reduce into RS -> local norm -> AG so later passes can overlap comm and computeTreat RS / AG staging around norm blocks as an upstream overlap-enabling family.
vLLM-origin shared-expert aux-stream overlapaux_streamshared_experts_streamshared expert near routervllm/model_executor/layers/fused_moe/runner/shared_experts.pyvllm/model_executor/layers/fused_moe/runner/moe_runner_base.pyMoE shared experts can record the cloned input on shared_experts_stream, wait on the caller stream, run in parallel with router-side work, and rejoin before mergeTreat shared-expert vs router overlap as an existing upstream sparse-model family.
vLLM-origin DCP async all-to-all overlapdcp_alltoallall_to_all_singleasync_op=Truevllm/v1/attention/ops/dcp_alltoall.pyOutput / LSE exchange uses async all-to-all handles instead of serializing collective completion on the main pathTreat DCP all-to-all windows as an upstream async-collective family.

10. vLLM-origin PR-backed / in-flight kernel-overlap families

PatternTrace keywordsPrimary codeExisting pathSkill should conclude
PR #35968 DSV3.2 multi-stream indexer overlapweights_projwkk_normaux_streamPR #35968vllm/model_executor/models/deepseek_v2.pyvllm/utils/torch_utils.pyClosed PR explored overlapping the small weights_proj GEMM with wk + k_norm on a secondary CUDA stream for decode batches instead of serializing both on the default streamTreat this as a concrete upstream decode-time kernel-overlap family when traces show underutilized projection overlap opportunities.
PR #39301 GLM5 router GEMM with PDL overlapTRTLLM_ENABLE_PDLrouter_gemmGLM5FI AR RMS fusionPR #39301vllm/model_executor/layers/fused_moe/router/gate_linear.pyvllm/csrc/moe/dsv3_router_gemm_utils.hThe GLM5 router GEMM path explicitly uses PDL so the router kernel can overlap with the preceding fused allreduce-plus-RMS block on supported GPUsTreat router-GEMM launch overlap on GLM5-like traces as an in-flight upstream family first.

11. Important toggles and caveats

Toggle / envLocationEffect on trace interpretation
enable_single_batch_overlappython/sglang/srt/server_args.pyEnables the SBO family.
SGLANG_BLACKWELL_OVERLAP_SHARED_EXPERTS_OUTSIDE_SBOpython/sglang/srt/environ.pyAlters how DeepSeek-style shared-expert overlap behaves on Blackwell.
SGLANG_DISAGG_STAGING_BUFFERpython/sglang/srt/environ.pyEnables the heterogeneous-TP staging-buffer family and its overlap windows.
SGLANG_STAGING_USE_TORCHpython/sglang/srt/disaggregation/common/staging_buffer.pyForces torch fallback for staging gather / scatter, so Triton staging kernels may disappear by design.
SGLANG_VIT_ENABLE_CUDA_GRAPHpython/sglang/srt/environ.pyCan intentionally disable vision aux_stream overlap.
enable_pdl / launch_with_pdlflashinfer/norm/__init__.pyflashinfer/activation.pyflashinfer/rope.pyflashinfer/fused_moe/core.pyflashinfer/comm/allreduce.pyEnables FlashInfer PDL across many kernels; launch grouping and same-stream overlap can change substantially when it is on.
trigger_completion_at_endflashinfer/comm/allreduce.pyFalse enables downstream PDL-aware overlap after FlashInfer allreduce fusion; True delays completion to kernel end and removes that overlap window.
use_cuda_graphflashinfer/fused_moe/cute_dsl/fused_moe.pyEnables the preallocated-buffer path and the safe aux-stream async-memset overlap in FlashInfer CuTeDSL MoE.
split_device_green_ctx*flashinfer/green_ctx.pyChanges trace shape by partitioning SMs into separate green contexts instead of overlapping full-device streams on the default context.
multi_stream_moetensorrt_llm/_torch/auto_deploy/config/default.yamlEnables the TensorRT-LLM shared-expert vs routed-expert overlap family.
multi_stream_mla_attntensorrt_llm/_torch/auto_deploy/config/default.yamlEnables the TensorRT-LLM MLA Q-vs-KV branch overlap family.
multi_stream_gemmtensorrt_llm/_torch/auto_deploy/config/default.yamlEnables generalized FP8 GEMM fork overlap in TensorRT-LLM AutoDeploy.
mlir_elementwise_fusiontensorrt_llm/_torch/auto_deploy/config/default.yamlCan absorb merge adds into larger fused kernels, so missing explicit merge nodes in TensorRT-LLM multi-stream traces may be intentional.
enable_torch_compilepython/sglang/srt/server_args.pypython/sglang/multimodal_gen/runtime/server_args.pyCompiler-generated reordering can hide or rename overlap windows.
enable_fused_grouped_gemm_combinePR #21877In-flight path that intentionally disables SBO because combine is folded into down-GEMM.
PassConfig.enable_spvllm/config/compilation.pyEnables vLLM's sequence-parallel staging family that creates RS / AG overlap opportunities.
PassConfig.fuse_gemm_commsvllm/config/compilation.pyEnables AsyncTP GEMM + collective overlap and auto-enables enable_sp when valid.
TokenSpeed --comm-fusion-max-num-tokens / --enable-allreduce-fusiondocs/configuration/server.mdGates TokenSpeed communication fusion; inspect it before treating all-reduce + compute separation as a new overlap gap.

12. Suggested refresh commands

These commands are only for maintainers refreshing this catalog by rescanning the local source trees. They are not used by the triage scripts at runtime.

# Optional sibling checkouts used for comparative scanning:
FLASHINFER_REPO=${FLASHINFER_REPO:-../flashinfer}
TRTLLM_REPO=${TRTLLM_REPO:-../TensorRT-LLM}
VLLM_REPO=${VLLM_REPO:-../vllm}
TOKENSPEED_REPO=${TOKENSPEED_REPO:-../tokenspeed}

rg -n "single_batch_overlap|alt_stream|shared_expert|scatter_stream|_fused_gather_to_staging_kernel|_fused_scatter_from_staging_kernel|async_op=True" python/sglang
rg -n "apply_qk_norm|vision.py|ring_attn|all_to_all_single|reorder_for_compute_comm_overlap|use_dual_stream" python/sglang/multimodal_gen python/sglang/srt
git log --all --format='%h %s' | rg -i 'fused|fusion|overlap|combine|all_to_all|ring attn|stream|triton|cutedsl|cuda'
rg -n "enable_pdl|launch_with_pdl|trigger_completion_at_end|aux_stream|use_async_memset|split_device_green_ctx|split_device_green_ctx_by_sm_count" "$FLASHINFER_REPO/flashinfer" "$FLASHINFER_REPO/include"
git -C "$FLASHINFER_REPO" log --all --format='%h %s' | rg -i 'fused|fusion|overlap|pdl|stream|rope|kv|quant|topk|moe'
rg -n "multi_stream_moe|multi_stream_mla_attn|multi_stream_gemm|record_event_passthrough|begin_aux_stream_passthrough|end_aux_stream_passthrough|wait_aux_stream_passthrough" "$TRTLLM_REPO/tensorrt_llm/_torch"
rg -n "mlir_elementwise_fusion|piecewise|cudagraph|caller_stream.synchronize" "$TRTLLM_REPO/tensorrt_llm/_torch"
git -C "$TRTLLM_REPO" log --all --format='%h %s' | rg -i 'overlap|multi-stream|aux stream|cudagraph|mlir|stream|flashinfer|moe|mla'
rg -n "fuse_gemm_comms|enable_sp|fused_matmul_reduce_scatter|fused_all_gather_matmul|shared_experts_stream|maybe_sync_shared_experts_stream|dcp_alltoall|async_op=True|aux_stream|maybe_execute_in_parallel" "$VLLM_REPO/vllm" "$VLLM_REPO/docs/design/fusions.md"
git -C "$VLLM_REPO" log --all --format='%h %s' | rg -i 'fused|fusion|overlap|allreduce|reduce-scatter|all-gather|all_to_all|stream|multi-stream|triton|cuda|router'
rg -n "enable_allreduce_fusion|comm_fusion|comm_fusion_max_num_tokens|allreduce|reduce_scatter" "$TOKENSPEED_REPO/python" "$TOKENSPEED_REPO/docs"
git -C "$TOKENSPEED_REPO" log --all --format='%h %s' | rg -i 'fused|fusion|overlap|allreduce|stream|comm|mla|tokenspeed_mla'
# GitHub PR scan terms for the connector or web UI:
#   "fused OR overlap repo:sgl-project/sglang"
#   "triton OR cutedsl OR cuda overlap repo:sgl-project/sglang"
#   "fused OR overlap repo:flashinfer-ai/flashinfer"
#   "pdl OR aux_stream OR green_ctx repo:flashinfer-ai/flashinfer"
#   "fused OR overlap repo:NVIDIA/TensorRT-LLM"
#   "multi-stream OR aux_stream OR cudagraph repo:NVIDIA/TensorRT-LLM"
#   "mlir OR piecewise OR flashinfer repo:NVIDIA/TensorRT-LLM"
#   "fused OR overlap repo:vllm-project/vllm"
#   "triton OR cuda overlap repo:vllm-project/vllm"
#   "multi-stream OR aux_stream overlap repo:vllm-project/vllm"
#   "fused OR overlap OR comm_fusion repo:lightseekorg/tokenspeed"
Referenced from SKILL.md