perf-workload-profiling

Instrument PyTorch training loops and CUDA kernels to measure latency and throughput.

Updated May 23, 2026
One-click install
npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill perf-workload-profiling-yo-steven
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: perf-workload-profiling
Source: https://github.com/yo-steven/skills-exploration-20260522/tree/main/skills/TensorRT-LLM/perf-workload-profiling
Command: npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill perf-workload-profiling-yo-steven

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

It solves the problem of unreliable or misleading performance measurements by showing how to instrument code so latency, throughput, and GPU timing are captured with proper warmup and synchronization discipline.

Core Features & Use Cases

  • Training loop instrumentation: Inject manual timing to measure per-iteration latency, compute throughput (samples/sec), and dataloader/data-load time.
  • Single op/kernel CUDA event benchmarking: Use CUDA events with warmup and per-iteration statistics (mean/median/std/min/max) without measurement-loop anti-patterns.
  • NVTX timeline labeling: Add human-readable range annotations (via decorators or context managers) to make profiler timelines easier to interpret, while avoiding NVTX for measurement.

Quick Start

Ask your AI assistant to “instrument my PyTorch training loop to report warmup-excluded per-iteration latency, throughput in samples/sec, and dataloader/data-load time using CUDA synchronization and timing.”

Frequently Asked Questions about perf-workload-profiling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I measure PyTorch training loop latency and throughput accurately on a GPU?

To measure PyTorch training loop latency and throughput accurately, inject manual timing to capture per-iteration latency, compute throughput in samples/sec, and record dataloader time using CUDA synchronization. Proper instrumentation requires warmup exclusion and pre-allocation to avoid perturbing results.

What is the best way to benchmark single CUDA operations in PyTorch?

The best way to benchmark single CUDA operations is using CUDA events with warmup iterations and per-iteration statistics like mean, median, std, min, and max. This approach avoids measurement-loop anti-patterns and synchronization issues that can skew kernel timing results.

How do NVTX annotations improve GPU profiling timeline readability?

NVTX annotations improve GPU profiling timeline readability by adding human-readable range labels to the profiler output. You apply these annotations via decorators or context managers to clearly mark execution phases, though NVTX should not be used for actual performance measurement.

Why are my PyTorch GPU timing measurements inconsistent across iterations?

PyTorch GPU timing measurements are inconsistent when warmup iterations are not excluded, memory is not pre-allocated, or when synchronization anti-patterns occur. Accurate GPU profiling requires disciplined warmup exclusion, pre-allocation, and proper CUDA event usage to avoid perturbing results.

Can I use host timing instead of CUDA events for GPU profiling in PyTorch?

You can use synchronized host timing instead of CUDA events for GPU profiling in PyTorch, provided you apply strict synchronization discipline. Both methods achieve GPU-accurate timing when paired with warmup exclusion and pre-allocation to prevent measurement perturbation.

What throughput metrics should I track when profiling a PyTorch training loop?

When profiling a PyTorch training loop, track per-iteration latency, throughput in samples/sec, and dataloader or data-load time. These metrics, captured with warmup exclusion and GPU-accurate timing, reveal workload bottlenecks and true training performance.