rh-runninghub/minimax-h3-multigpu-lightning/llm-torch-profiler-analysis
Claude Code and agent skill by rh-runninghub/minimax-h3-multigpu-lightning
- community
Checking that the SKILL.md file is still in the repository.
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 vskill@latest install rh-runninghub/minimax-h3-multigpu-lightning/llm-torch-profiler-analysisSKILL.md
The same SKILL.md was published earlier as rh-runninghub/minimax-h3-multigpu-lightning/llm-torch-profiler-analysis.
Unified LLM Torch Profiler Analysis
Overview
Use this skill for torch.profiler analysis across:
sglangvllmTensorRT-LLMTokenSpeed
There is only one public workflow:
triage
Preferred unified entrypoint:
Backwards-compatibility shim (kept so older docker exec ... analyze_sglang_torch_profile.py ... calls keep working; it just forwards to the unified entrypoint):
Markdown bundling helper:
triage always prints the same three tables:
- kernel table
- overlap-opportunity table
- fuse-pattern table
By default, all three tables only render rows at or above 1.0% cumulative GPU-time share. Rows below that are hidden by default unless the user asks for a lower cutoff.
Keep the fuse-pattern table source-backed and deterministic. Do not turn it into a fuzzy matcher.
If exact source-backed matching is weak but a kernel cluster is still close to a known family, add one short note after the tables with exactly one of:
highmediumlow
Capability Matrix
| Capability | SGLang | vLLM | TensorRT-LLM | TokenSpeed | |
|---|---|---|---|---|---|
| Existing trace triage | yes | yes | yes | yes | |
| Single-trace live capture | yes | yes, if torch profiler is enabled on server | requires profiler control endpoints | yes, if /start_profile and /stop_profile are exposed | |
| Two-trace mapping+formal triage | yes | yes | yes | yes | |
| Stage-separated live workload | yes | yes | yes, with a writable shared trace dir or per-stage host runner | yes, via workload-separated HTTP capture | |
--profile-by-stage capture | yes | no | no | no | |
--profile-prefix control | yes | usually ignored on HTTP profiler route | usually ignored on HTTP profiler route | yes, mapped to profile_id |
For TensorRT-LLM, live capture only works when the server exposes /start_profile and /stop_profile, and when the deployment already provides a shared trace path plus the required env vars.
For TokenSpeed, this skill supports both existing trace triage and live capture against current servers that expose /start_profile and /stop_profile. The live helper sends output_dir, activities, with_stack, record_shapes, and profile_id in the start payload. TokenSpeed also has its own native profile_by_stage field for manual capture, but the unified helper uses workload-separated prefill/ and decode/ directories by default so the tables stay comparable across frameworks.
Real H100 Validation
The current reference run is the 4x H100 matrix captured on 2026-04-23 on h100_sglang under:
/data/bbuf/validate/unified_llm_profiler_skill/runs/20260423_h100_large_model_matrix_v3
Rendered markdown bundle:
/data/bbuf/validate/unified_llm_profiler_skill/runs/20260423_h100_large_model_matrix_v3/h100_large_model_matrix_v3_bundle.md
Validated model directories:
mixtral_8x7b_instructqwen2_5_32b_instructqwen3_32b
Each model directory contains:
analysis_sglang.txtanalysis_vllm.txtanalysis_trtllm.txt- framework-specific trace roots and probe artifacts
Validated matrix:
| Model | SGLang | vLLM | TensorRT-LLM | Result | |
|---|---|---|---|---|---|
mistralai/Mixtral-8x7B-Instruct-v0.1 | 4x H100 | 4x H100 | 4x H100 | three tables rendered correctly on all three frameworks; benchmark probes returned direct, non-empty text | |
Qwen/Qwen2.5-32B-Instruct | 4x H100 | 4x H100 | 4x H100 | three tables rendered correctly on all three frameworks; benchmark probes returned direct, non-empty text | |
Qwen/Qwen3-32B | 4x H100 | 4x H100 | 4x H100 | three tables rendered correctly on all three frameworks; vLLM and TensorRT-LLM chat probes often emitted <think> prefixes |
Use this run as the main H100 reference. The older 2026-04-22 single-card Qwen3 matrix is still useful for bring-up, but it is not the default reference anymore. TokenSpeed support was added later and is covered by existing-trace triage and HTTP profiler-control support, but it is not part of this older H100 validation matrix yet.
Stage-separated workload validation captured on 2026-05-01 on h100_sglang:
/data/bbuf/validate/unified_llm_profiler_skill/runs/20260501_stage_split_validation/data/bbuf/validate/unified_llm_profiler_skill/runs/20260501_stage_split_validation_large
Validated models:
| Model | GPU | Workloads | Result | |
|---|---|---|---|---|
Qwen/Qwen2.5-0.5B-Instruct | 1x H100 | prefill 4090->1, decode 1->2048 | generated separate prefill/*.trace.json.gz and decode/*.trace.json.gz; kernel, overlap, and fuse tables rendered with separate extend/prefill and decode sections | |
Qwen/Qwen2.5-1.5B-Instruct | 1x H100 | prefill 4090->1, decode 1->2048 | generated separate prefill/*.trace.json.gz and decode/*.trace.json.gz; kernel, overlap, and fuse tables rendered with separate extend/prefill and decode sections | |
Qwen/Qwen2.5-7B-Instruct | 1x H100 | prefill 4090->1, decode 1->2048 | generated separate traces; prefill kernel table captured 28-layer GEMM/FA3/RMSNorm work, decode captured 5-step graph launches, and fuse rows were split by stage | |
Qwen/Qwen2.5-14B-Instruct | 1x H100 | prefill 4090->1, decode 1->2048 | generated separate traces; prefill kernel table captured 48-layer GEMM/FA3/RMSNorm work, decode captured 5-step graph launches, and fuse rows were split by stage | |
Qwen/Qwen3-8B | 2x H100, TP=2 | prefill 4090->1, decode 1->2048, warmup 10/capture 5 | generated separate prefill/decode traces and all three tables; unique probe prompts avoided prefix-cache pollution in the prefill table | |
mistralai/Mistral-7B-Instruct-v0.3 | 2x H100, TP=2 | prefill 4090->1, decode 1->2048, warmup 10/capture 5 | generated separate prefill/decode traces and all three tables; server logs showed no repeated-prompt prefix-cache shortcut during the active prefill window |
This validation also covers the compatibility fix for older SGLang profiler state machines: workload-separated live capture labels stages by output directory and avoids nesting SGLang's internal profile_by_stage state machine inside each workload. The helper adds one internal scheduler guard step because SGLang increments forward_ct before checking whether the profiler should stop; without that guard, a num_steps=1 prefill capture can stop just before the actual prefill forward. The 2026-05-01 two-card validation artifacts for the additional models are:
/data/bbuf/validate/core_skill_validation_20260501/qwen3_8b/profiler/data/bbuf/validate/core_skill_validation_20260501/mistral_7b_instruct_v03/profiler
To render a validated run into one markdown document:
The bundle groups by model and keeps the three tables for each framework.
H100 notes:
- all three frameworks now render kernel, overlap, and fuse tables with separate
extend/prefillanddecodesections when the trace contains a clean stage split - SGLang live capture is validated and calls the server profiler API directly instead of shelling out to
sglang.profiler - SGLang trace flush can lag well beyond a few seconds, so the runner waits longer for artifacts than the earlier implementation
- SGLang kernel-site reconstruction keeps sampling disabled in the mapping path so the optimized parser does not perturb SGLang table output; equality rechecks matched for
Mixtral-8x7B-Instruct-v0.1,Qwen3-32B, andnvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8 - vLLM live capture requires
--output-dirto match the servertorch_profiler_dir; the validated H100 flow uses--profiler-config {"profiler":"torch","torch_profiler_dir":"..."}and then drives/start_profileand/stop_profile - TensorRT-LLM validation stays on
--backend pytorch; the H100 flow writes the trace withTLLM_TORCH_PROFILE_TRACEand then analyzes the saved trace - TensorRT-LLM current mainline was rechecked at
0722c5f47d2cae69ac1a237da51e550dd214532con 2026-06-26; the latest delta affects KV eviction / block-offset staging rather than profiler trace controls, so theb9e1945profiler evidence still applies: PyTorch profiling usesrecord_shapes=Trueandwith_modules=True, but notwith_stack=True; keep the override path for table-quality Python locations unless the target image proves otherwise - TokenSpeed trace analysis has first-class registry rows for native TokenSpeed CuTe DSL MLA, MLA KV pack + FP8 quantize, fused top-k/top-p sampling, persistent lm_head GEMM, and NVFP4 GEMM + SwiGLU + quant; live capture still requires an existing torch-profiler trace until the target TokenSpeed image exposes a supported profiler API
- on this host, keep all trace roots under
/data/..., not/home/...
When To Use It
- inspect a
torch.profilertrace or profile directory fromsglang,vllm,
TensorRT-LLM, or TokenSpeed
- profile a live serving endpoint and analyze the result
- summarize which kernel families dominate prefill or decode
- map kernels back to Python code paths
- judge whether a code path still leaves overlap opportunity
- check whether an already-known fusion or overlap path should have applied
Diffusion Backend Gate
For diffusion benchmark or profiling work, only analyze traces produced by the native SGLang diffusion backend.
If the run that generated the trace logs any of:
Falling back to diffusers backendUsing diffusers backendLoaded diffusers pipeline
stop the workflow instead of analyzing the trace. Handle it as a backend-selection issue, not as native-kernel profiler evidence.
Main Flows
Stage-Separated Live Capture Contract
Live capture must not use one mixed prompt as the default. By default, analyze_llm_torch_profile.py --url ... captures two labeled workloads and then renders the same three tables with separate stage sections:
- prefill: synthetic input length
4090, output length1 - decode: synthetic input length
1, output length2048
Every live profiler path warms up 10 steps before arming the profiler and then captures 5 active steps by default. Keep this warmup/active split aligned across SGLang, vLLM, and TensorRT-LLM before comparing kernel tables.
Use these options to override the contract when the benchmark workload is known:
Allowed --profile-workload values:
both: default; capture prefill and decode separatelyprefill: capture only the long-input / one-token workloaddecode: capture only the one-input / long-output workloadlegacy: keep the old--probe-prompt/--probe-max-new-tokensbehavior
For sglang-sota-humanize-loop, do not use the defaults if the slow SGLang benchmark scenario has a known input/output distribution. Set the profiler lengths from that slow scenario instead: prefill uses the slow input length with output 1, and decode uses input 1 with the slow output length. For a mixed dataset, profile the slowest representative bucket such as the p50 or p95 input/output pair used in the benchmark report, and record the bucket in the artifact notes.
1. Single-trace triage from an existing profile dir or trace
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingsglang/.claude/skills/llm-torch-profiler-analysis/SKILL.md
Popularity
- Repository stars
- 99
- Repository forks
- 13
- 7-day trend score
- 23
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/rh-runninghub/minimax-h3-multigpu-lightning/llm-torch-profiler-analysis)