LLM Torch Profiler Trace Analysis
BBuf/AI-Infra-Auto-Driven-SKILLS
Analyzes Torch Profiler traces from SGLang, vLLM and TensorRT-LLM servers into kernel attribution, overlap and fusion tables.
Unified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed.
$ npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install sgl-project/sglang llm-torch-profiler-analysis --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/sgl-project/sglang.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/llm-torch-profiler-analysis .claude/skills/llm-torch-profiler-analysis && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "llm-torch-profiler-analysis" agent skill from https://github.com/sgl-project/sglang/tree/main/.agents/skills/llm-torch-profiler-analysis into .claude/skills/llm-torch-profiler-analysis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "llm-torch-profiler-analysis", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/sgl-project/sglang/tree/main/.agents/skills/llm-torch-profiler-analysisType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install sgl-project/sglang llm-torch-profiler-analysis --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sgl-project/sglang.git skills-src && mkdir -p .agents/skills && cp -r skills-src/.agents/skills/llm-torch-profiler-analysis .agents/skills/llm-torch-profiler-analysis && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "llm-torch-profiler-analysis" agent skill from https://github.com/sgl-project/sglang/tree/main/.agents/skills/llm-torch-profiler-analysis into .agents/skills/llm-torch-profiler-analysis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "llm-torch-profiler-analysis", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install sgl-project/sglang llm-torch-profiler-analysis --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sgl-project/sglang.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/.agents/skills/llm-torch-profiler-analysis .cursor/skills/llm-torch-profiler-analysis && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "llm-torch-profiler-analysis" agent skill from https://github.com/sgl-project/sglang/tree/main/.agents/skills/llm-torch-profiler-analysis into .cursor/skills/llm-torch-profiler-analysis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "llm-torch-profiler-analysis", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/sgl-project/sglang.git --path .agents/skills/llm-torch-profiler-analysis--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install sgl-project/sglang llm-torch-profiler-analysis --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sgl-project/sglang.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/.agents/skills/llm-torch-profiler-analysis .gemini/skills/llm-torch-profiler-analysis && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "llm-torch-profiler-analysis" agent skill from https://github.com/sgl-project/sglang/tree/main/.agents/skills/llm-torch-profiler-analysis into .gemini/skills/llm-torch-profiler-analysis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "llm-torch-profiler-analysis", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install sgl-project/sglang llm-torch-profiler-analysisInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/sgl-project/sglang.git skills-src && mkdir -p .github/skills && cp -r skills-src/.agents/skills/llm-torch-profiler-analysis .github/skills/llm-torch-profiler-analysis && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "llm-torch-profiler-analysis" agent skill from https://github.com/sgl-project/sglang/tree/main/.agents/skills/llm-torch-profiler-analysis into .github/skills/llm-torch-profiler-analysis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "llm-torch-profiler-analysis", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install sgl-project/sglang llm-torch-profiler-analysis --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/sgl-project/sglang.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/.agents/skills/llm-torch-profiler-analysis .opencode/skills/llm-torch-profiler-analysis && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "llm-torch-profiler-analysis" agent skill from https://github.com/sgl-project/sglang/tree/main/.agents/skills/llm-torch-profiler-analysis into .opencode/skills/llm-torch-profiler-analysis/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "llm-torch-profiler-analysis", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
llm-torch-profiler-analysisUnified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed.
LLM Torch Profiler Analysis is an agent skill from sgl-project/sglang. 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.
Its SKILL.md is about 6.4k tokens, which your agent loads only when the skill is triggered. The skill folder holds 19 other files, including scripts and reference files (for example `references/fuse-overlap-catalog.md`, `references/heuristics.md` and `references/overlap-catalog.md`).
It sits in Development, covering Performance optimization and LLM inference and serving. It works with SGLang, NVIDIA AI Platform and vLLM. The repository describes itself as: SGLang is a high-performance serving framework for large language models and multimodal models. The licence is Apache-2.0.
7 steps, taken from the step headings in SKILL.md.
Read from SKILL.md and the folder at commit f620d73. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Ships 12 files in scripts/ (Python and Shell), which the agent can run.
Shell commands in SKILL.md call:
python3curldockerFrom the folder's file list and the shell code blocks in SKILL.md.
No URLs in SKILL.md. Its commands use curl and docker, which can reach the network depending on how they are called.
From URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
LLM Torch Profiler Analysis loads about 6.4k tokens when it runs, and up to ~40k if it reads all its reference files. Until then it costs about 88 tokens; SKILL.md has 2,629 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check found no risky patterns in SKILL.md.
Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.
The full file from sgl-project/sglang at commit f620d73, republished under its Apache-2.0 licence (© sgl-project). 2,629 words, ~6,368 tokens.
.claude/skills/llm-torch-profiler-analysis/SKILL.md (or your agent's skills folder). This skill also uses 17 other files; get the full folder from GitHub.Use this skill for torch.profiler analysis across:
sglangvllmTensorRT-LLMTokenSpeedThere is only one public workflow:
triagePreferred 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:
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 | 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.
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_v3Rendered markdown bundle:
/data/bbuf/validate/unified_llm_profiler_skill/runs/20260423_h100_large_model_matrix_v3/h100_large_model_matrix_v3_bundle.mdValidated model directories:
mixtral_8x7b_instructqwen2_5_32b_instructqwen3_32bEach model directory contains:
analysis_sglang.txtanalysis_vllm.txtanalysis_trtllm.txtValidated 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_largeValidated 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/profilerTo render a validated run into one markdown document:
python3 scripts/render_triage_markdown_bundle.py \
--analysis-root /data/bbuf/validate/unified_llm_profiler_skill/runs/20260423_h100_large_model_matrix_v3 \
--output /data/bbuf/validate/unified_llm_profiler_skill/runs/20260423_h100_large_model_matrix_v3/h100_large_model_matrix_v3_bundle.mdThe bundle groups by model and keeps the three tables for each framework.
H100 notes:
extend/prefill and decode sections when the trace contains a clean stage splitsglang.profilerMixtral-8x7B-Instruct-v0.1, Qwen3-32B, and nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-FP8--output-dir to match the server torch_profiler_dir; the validated H100 flow uses --profiler-config {"profiler":"torch","torch_profiler_dir":"..."} and then drives /start_profile and /stop_profile--backend pytorch; the H100 flow writes the trace with TLLM_TORCH_PROFILE_TRACE and then analyzes the saved trace0722c5f47d2cae69ac1a237da51e550dd214532c on 2026-06-26; the latest delta affects KV eviction / block-offset staging rather than profiler trace controls, so the b9e1945 profiler evidence still applies: PyTorch profiling uses record_shapes=True and with_modules=True, but not with_stack=True; keep the override path for table-quality Python locations unless the target image proves otherwise/data/..., not /home/...torch.profiler trace or profile directory from sglang, vllm,
TensorRT-LLM, or TokenSpeedFor 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 pipelinestop the workflow instead of analyzing the trace. Handle it as a backend-selection issue, not as native-kernel profiler evidence.
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:
4090, output length 11, output length 2048Every 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:
--profile-workload both \
--warmup-steps 10 --num-steps 5 \
--prefill-input-len 4090 --prefill-output-len 1 \
--decode-input-len 1 --decode-output-len 2048Allowed --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-tokens behaviorFor 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.
python3 scripts/analyze_llm_torch_profile.py \
--input /path/to/profile_dir_or_trace.json.gzUse this when one trace is enough. The overlap table stays conservative in single-trace mode and will tell you when a mapping/formal pair is needed.
python3 scripts/analyze_llm_torch_profile.py \
--framework sglang \
--url http://127.0.0.1:30000 \
--output-dir /data/bbuf/validate/unified_llm_profiler_skill/runs/example/sglang_profile_live \
--num-steps 5 \
--warmup-steps 10 \
--profile-by-stage \
--profile-workload bothThe script sends POST /start_profile to the SGLang server directly.
Keep --output-dir under /data/... so later analysis and docs can see the trace.
The script writes server_args.json, warms up with the same workload shape,
sends the active probe requests after profiling is armed, captures separate
prefill/ and decode/ profile roots by default, and waits longer for trace
flush than the earlier implementation.
For the default workload-separated capture, the directory name labels the stage
and the SGLang internal profile_by_stage mode is not used inside each
workload. This avoids mixing a one-token prefill probe with a separate decode
profile. The helper still adds one internal guard step because older SGLang
profilers check the target counter before running the next forward.
Launch vLLM with torch profiler enabled, for example:
vllm serve meta-llama/Llama-3.1-8B-Instruct \
--profiler-config '{"profiler":"torch","torch_profiler_dir":"/data/bbuf/validate/unified_llm_profiler_skill/runs/example/vllm_profile"}'Then run:
python3 scripts/analyze_llm_torch_profile.py \
--framework vllm \
--url http://127.0.0.1:8000 \
--output-dir /data/bbuf/validate/unified_llm_profiler_skill/runs/example/vllm_profile \
--num-steps 5 \
--warmup-steps 10 \
--no-profile-by-stage \
--profile-workload bothFor vLLM, --output-dir must point to the same torch_profiler_dir the server uses.
The current vLLM profiler config already defaults torch_profiler_with_stack=true,
so the runner only needs to set torch_profiler_dir.
On h100_sglang, external vLLM containers should mount both:
/data/.cache/huggingface:/root/.cache/huggingface/data/bbuf/validate/unified_llm_profiler_skill:/data/bbuf/validate/unified_llm_profiler_skillUse this only when the server exposes POST /start_profile and POST /stop_profile,
and the trace path is shared with the current machine.
Typical env expectations are:
TLLM_PROFILE_START_STOP=<start>-<stop> such as 10-20TLLM_TORCH_PROFILE_TRACE=/shared/path/trace.json or .json.gzThen run:
python3 scripts/analyze_llm_torch_profile.py \
--framework trtllm \
--url http://127.0.0.1:8000 \
--output-dir /shared/path \
--num-steps 5 \
--no-profile-by-stage \
--profile-workload bothIf the deployment does not expose the profiler control endpoints, fall back to analyzing
an existing trace instead of trying live capture.
If the TensorRT-LLM trace output is configured as one fixed file path, use
scripts/run_trtllm_pytorch_profile_host.sh --stage prefill and --stage decode
instead of direct --profile-workload both, so each stage gets its own trace file.
On the current TensorRT-LLM mainline path, py_executor.py creates the torch profiler
with record_shapes=True and with_modules=True but not with_stack=True.
For table-quality validation, use the override generator:
python3 scripts/make_trtllm_py_executor_override.py \
--source /path/to/original/py_executor.py \
--output /data/bbuf/validate/unified_llm_profiler_skill/overrides/trtllm/py_executor_with_stack.pyThe matrix runner does this automatically on H100 before TensorRT-LLM capture starts.
This is the validated TensorRT-LLM flow on h100_sglang:
trtllm-serve with TLLM_PROFILE_START_STOP=<start>-<stop> and TLLM_TORCH_PROFILE_TRACE=/data/.../trace.json--input /data/.../trace.jsonFor a running TokenSpeed server that exposes the profiler routes, the unified helper can drive live capture:
python3 scripts/analyze_llm_torch_profile.py \
--framework tokenspeed \
--url http://127.0.0.1:8000 \
--output-dir /data/bbuf/validate/unified_llm_profiler_skill/runs/example/tokenspeed_profile \
--num-steps 5 \
--warmup-steps 10 \
--no-profile-by-stage \
--profile-workload both \
--profile-prefix ts-triageThe helper sends POST /start_profile with:
output_dir: the --output-dir pathactivities: ["CPU", "GPU"]with_stack: truerecord_shapes: falseprofile_id: --profile-prefix, with -prefill or -decode appended during workload-separated captureIt then sends OpenAI-compatible probe requests and calls POST /stop_profile.
TokenSpeed writes files such as ts-triage-prefill-TP-0.trace.json.gz under the
output directory. If the server was launched with multiple TP ranks, expect one
trace per rank.
Existing TokenSpeed torch-profiler traces can still be analyzed directly:
python3 scripts/analyze_llm_torch_profile.py \
--framework tokenspeed \
--input /path/to/tokenspeed_profile_dir_or_trace.json.gzTokenSpeed's own manual profiler control surface can also be used:
curl -X POST http://127.0.0.1:8000/start_profile \
-H 'Content-Type: application/json' \
-d '{"output_dir":"/data/bbuf/profiles/tokenspeed","activities":["CPU","GPU"],"with_stack":true,"record_shapes":false,"profile_id":"ts-manual"}'
# send representative workload here
curl -X POST http://127.0.0.1:8000/stop_profileFor server-side automatic stop, pass num_steps. For TokenSpeed-native
EXTEND/DECODE split, pass profile_by_stage: true; this produces files with
stage suffixes such as -EXTEND and -DECODE.
TokenSpeed's benchmark driver can capture traces too:
tokenspeed bench serve \
--base-url http://127.0.0.1:8000 \
--model <model> \
--dataset-name random \
--random-input-len 4090 \
--random-output-len 1 \
--num-prompts 64 \
--profile \
--profile-num-steps 5 \
--extra-body '{"output_dir":"/data/bbuf/profiles/tokenspeed","activities":["CPU","GPU"],"with_stack":true,"profile_id":"ts-bench"}'If output_dir is omitted, TokenSpeed falls back to TOKENSPEED_PROFILER_DIR
and then /tmp.
Use scripts/probe_llm_server.py with
--framework tokenspeed for a small OpenAI-compatible endpoint probe before or
after trace collection:
python3 scripts/probe_llm_server.py \
--framework tokenspeed \
--url http://127.0.0.1:8000 \
--requests 6 \
--max-tokens 48For sglang-sota-humanize-loop, keep TokenSpeed profiler evidence aligned to
the same slow scenario bucket as the benchmark result. Prefer the unified
workload-separated live capture when possible; if only a mixed agentic trace is
available, label that limitation in analysis/root-cause.md before comparing
it to SGLang prefill/decode traces.
python3 scripts/analyze_llm_torch_profile.py \
--mapping-input /path/to/graph_off_profile_dir \
--formal-input /path/to/graph_on_profile_dirUse this when you need stronger overlap attribution and kernel-to-source mapping.
python3 scripts/analyze_llm_torch_profile.py \
--framework sglang \
--mapping-url http://127.0.0.1:31025 \
--formal-url http://127.0.0.1:31026 \
--num-steps 5 \
--profile-by-stageFor vllm or TensorRT-LLM, use the same shape but pass:
--framework vllm or --framework trtllm--mapping-output-dir ...--formal-output-dir ...--no-profile-by-stageFor TokenSpeed, either use --mapping-url and --formal-url against servers
that expose /start_profile and /stop_profile, or pass two existing trace
directories with --mapping-input and --formal-input.
profile_by_stage--profile-by-stage is only meaningful on the SGLang live-capture path.
--profile-workload both / prefill / decode, workload directories
are the stage labels; the live-capture helper disables SGLang's internal
stage profiler per workload, warms up first, and captures the requested
active step count for the selected workload.profile_by_stage is
still useful because prefill and decode usually have very different
bottlenecks.profile_by_stage.vllm, TensorRT-LLM, and TokenSpeed, disable it with
--no-profile-by-stage.Use when you want the lowest-friction report:
Prefer this by default.
Use when you need:
Do not call the mapping pass a "fast profile".
It exists to recover kernel -> cpu_op -> python scope.
--profile-workload both; use legacy only when reproducing an old trace contract.--profile-by-stage
mainly for legacy or manually collected traces.h100_sglang, create or clean the target trace directory through docker exec sglang_bbuf ... so the path is definitely writable under /data.triage for the three-table report.PR-backed / in-flight sections. Prefer reporting:high, medium, or low only.
Base that note on the full pattern shape, not on one kernel name alone.
Prefer semantic cues such as producer-consumer chain, source locations, CPU op names, TP context, and model-specific structure.
Do not rewrite the script table itself to include these heuristic judgments.Load these only when needed:
Return:
high / medium / low when exact matching is inconclusive© sgl-project, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
SKILL.md and 17 other files (scripts, references) in .agents/skills/llm-torch-profiler-analysis of sgl-project/sglang.
Open the folder on GitHubat commit f620d73
We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in sgl-project/sglang, which our catalogue first saw on October 7, 2026.
LLM Torch Profiler Analysis next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| LLM Torch Profiler Analysis this skillsgl-project/sglang | 37k | 2 repos | ~6.4k | Automated safety check: Pass | Apache-2.0 | |
| LLM Torch Profiler Trace AnalysisBBuf/AI-Infra-Auto-Driven-SKILLS | 925 | — | ~2.8k | Automated safety check: Pass | None | |
| Graphsignalgraphsignal/graphsignal | 257 | — | ~6.2k | Automated safety check: Pass | Apache-2.0 | |
| LLM Pipeline Profiler AnalysisBBuf/AI-Infra-Auto-Driven-SKILLS | 925 | — | ~3.9k | Automated safety check: Pass | None | |
| Dstack Prototypingdstackai/dstack | 2.3k | — | ~1.6k | Automated safety check: Pass | MPL-2.0 | |
| SGLang Structured ServingOrchestra-Research/AI-Research-SKILLs | 13k | 2 repos | ~2.9k | Automated safety check: Pass | MIT |
BBuf/AI-Infra-Auto-Driven-SKILLS
Analyzes Torch Profiler traces from SGLang, vLLM and TensorRT-LLM servers into kernel attribution, overlap and fusion tables.
graphsignal/graphsignal
Profile AI inference workloads (vLLM, SGLang, TensorRT-LLM, PyTorch, any GPU application) with the Graphsignal profiler and read the results from its local /signals JSON endpoint.
BBuf/AI-Infra-Auto-Driven-SKILLS
Breaks LLM torch profiler traces down by forward pass, layer and kernel, with timing tables and Perfetto time ranges for the layers you want to inspect.
dstackai/dstack
Use with the dstack skill for model-serving work when the image, serving command, resources, backend/fleet choice, or service behavior is not proven.
Orchestra-Research/AI-Research-SKILLs
Covers serving LLMs with SGLang, whose RadixAttention reuses cached prefixes, and constraining output to JSON, regex or grammar for agent and tool-calling workloads.
BBuf/AI-Infra-Auto-Driven-SKILLS
Compares SGLang, vLLM, TensorRT-LLM and TokenSpeed on one model and workload, searching server flags to find the best deployment command within a latency SLA.
sgl-project/sglang
Replay-first debug flow for SGLang serving problems. An agent skill from sgl-project/sglang.
sgl-project/sglang
Start and persistently pursue a goal to babysit an SGLang pull request until selected GitHub Actions workflows pass on the latest PR head.
sgl-project/sglang
Compute the optimal --mamba-full-memory-ratio (or --max-mamba-cache-size pin) for a hybrid attention + linear-attention (Mamba / GDN / KDA) model's two serving memory pools, from the workload and…
sgl-project/sglang
Debug hanging issues in SGLang distributed inference (TP/PP/DP/EP).
sgl-project/sglang
Conventions for SGLang environment variables — where to define, how to access, how to name, and how to deprecate.
sgl-project/sglang
Write, calibrate, and debug the prefill-vs-decode logprob (KL) consistency tests in sglang -- the two independent conditions a zero requires (every operator batch-invariant, and the two paths…
Works with
Categories
Unified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed. LLM Torch Profiler Analysis is an agent skill from sgl-project/sglang. Unified LLM torch-profiler triage skill for sglang, vllm, TensorRT-LLM, and TokenSpeed.
LLM Torch Profiler Analysis fits situations like: inspect an existing trace.json(.gz); profile directory; drive live profiling against a running server when supported and return one three-table report with kernel; overlap-opportunity.
Run `npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a claude-code`. Or copy the skill folder (.agents/skills/llm-torch-profiler-analysis in sgl-project/sglang) into .claude/skills/llm-torch-profiler-analysis in your project. Claude Code loads it when a task matches its description.
Run `npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a codex`. Or copy the skill folder (.agents/skills/llm-torch-profiler-analysis in sgl-project/sglang) into .agents/skills/llm-torch-profiler-analysis in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add sgl-project/sglang --skill llm-torch-profiler-analysis -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/llm-torch-profiler-analysis, .gemini/skills/llm-torch-profiler-analysis, .github/skills/llm-torch-profiler-analysis and .opencode/skills/llm-torch-profiler-analysis in your project.
Going by SKILL.md and its folder, LLM Torch Profiler Analysis needs Python and a shell for the scripts in its folder and the command-line tools its instructions call (python3, curl and docker). Our summary lists: Python 3; A Bash shell; Docker.
SKILL.md contains no URLs. Its commands use curl and docker, which can reach the network depending on how they are called. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.
LLM Torch Profiler Analysis is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 6.4k tokens (SKILL.md is roughly 25k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 33k tokens, read only when the agent opens those files.
Skills that share tags, products or a category with LLM Torch Profiler Analysis: LLM Torch Profiler Trace Analysis (BBuf/AI-Infra-Auto-Driven-SKILLS, 925 stars), Graphsignal (graphsignal/graphsignal, 257 stars), LLM Pipeline Profiler Analysis (BBuf/AI-Infra-Auto-Driven-SKILLS, 925 stars) and Dstack Prototyping (dstackai/dstack, 2.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
sgl-project (a GitHub organization) maintains it in sgl-project/sglang, which has 36,907 GitHub stars. The repository holds 32 skills in this directory. The repository was last updated on October 9, 2026.
Source: sgl-project/sglang on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.