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

Source Map

Use these upstream files when the workflow or behavior needs to be justified from SGLang source.

Profiler entrypoints

  • python/sglang/profiler.py

    • live profiler CLI
    • writes server_args.json
    • forwards num_steps, profile_by_stage, merge_profiles, and profile_prefix
  • python/sglang/test/send_one.py

    • minimal request path that can trigger profiling from a single command
  • python/sglang/bench_serving.py

    • profile-capable serving benchmark path
    • forwards profile_activities, profile_by_stage, profile_stages, and profile_prefix

Scheduler-side trace writing

  • python/sglang/srt/managers/scheduler_profiler_mixin.py

    • actual trace start/stop behavior
    • filename pattern for TP/DP/PP/EP and optional stage suffixes
    • CUDA_PROFILER and torch profiler handling
  • python/sglang/srt/utils/profile_merger.py

    • merged distributed trace behavior
    • why merged traces should be treated differently from rank-local traces
  • python/sglang/srt/utils/profile_utils.py

    • newer profile v2 manager path used for stage-based traces

Documentation and tests

  • docs/docs/developer_guide/benchmark_and_profiling.mdx

    • canonical profiling docs
  • test/registered/profiling/test_start_profile.py

    • validates /start_profile behavior, including CUDA_PROFILER
  • test/registered/profiling/test_profile_v2.py

    • validates stage-scoped trace outputs under SGLANG_PROFILE_V2
Referenced from SKILL.md