Nsight trace analysis
Use this skill when a profiling run already contains manifest.yaml and
trace.nsys-rep. The analysis workflow exports supported nsys stats reports
and writes a stable analysis.json artifact. It does not rerun the profiling
target.
Preconditions
Before analyzing a run:
- Read
manifest.yamland identify the target, device, workload settings, capture range, record IDs, Git commit, and expected trace path. - Confirm that
trace.nsys-repbelongs to the same run directory. - Run
nsys --version. Use a version that can read the trace and supports thenvtx_pushpop_traceandnvtx_gpu_proj_tracereports. - Treat generated traces, SQLite exports, report CSV files, and analysis JSON
as local artifacts under the ignored
inference_profiling/directory.
Do not parse .nsys-rep directly. Use NVIDIA's supported nsys stats reports.
Generate the analysis
From the repository root, run:
PYTHONPATH=./ uv run python development/profiling/analyze.py \
--run-dir RUN_DIRECTORY
Replace RUN_DIRECTORY with the directory containing manifest.yaml and
trace.nsys-rep.
The command creates these files:
stats/nsys_nvtx_pushpop_trace.csvstats/nsys_nvtx_gpu_proj_trace.csvanalysis.json
If the command fails, report the exact Nsight version and error. Check for a missing executable, an incompatible trace, missing NVTX data, or report-column changes before modifying the parser.
Read the result
Read analysis.json in this order:
- Check
provenancefor the manifest, trace, report paths, and Nsight version. - Check
runfor the device, Git commit, workload settings, capture range, and record count. - Read
warnings. Resolve missing iterations or capture ranges before drawing performance conclusions. - Use
iteration_summaryto understand timing level and variance across the measured passes. - Use
iterationsto locate an unusually slow or incomplete pass. - Use
host_rangesfor CPU-side orchestration and nested-range costs. - Use
gpu_projected_rangesfor GPU work associated with each NVTX range.
Range names are scoped below the harness iteration. Treat
preprocessing.resize and postprocessing.resize as separate operations.
When GPU projections are unavailable, expect an empty
gpu_projected_ranges list, null iteration GPU measurements, and a warning.
All durations use nanoseconds and include the _ns suffix.
Preserve timing semantics
Interpret the fields as follows:
host_ranges[].inclusivemeasures CPU time between an NVTX push and pop and includes nested child ranges.host_ranges[].exclusivesubtracts nested child-range duration from the host range.gpu_projected_ranges[].projectedmeasures the interval covered by GPU operations launched from inside that NVTX range.iterations[].hostanditerations[].gpu_projectiondescribe different clocks and must remain separate.
Do not:
- call host-inclusive or host-exclusive duration GPU latency
- sum inclusive timings from parents and children
- treat GPU projection as the sum of kernel durations
- infer a regression from one run
- compare runs with different targets, inputs, devices, synchronization policies, capture ranges, or Nsight versions without stating the difference
Report findings
When summarizing a run, include:
- profile name, run ID, Git commit, device, and Nsight version
- warmup, iteration count, record count, and synchronization policy
- host-inclusive and GPU-projected iteration statistics with units
- the ranges that account for the largest host and projected-GPU totals
- warnings, missing data, first-iteration effects, or large variance
- the exact
analysis.jsonpath
Describe measurements before suggesting optimizations. If a range is slow only on the host, inspect preparation, Python orchestration, synchronization, or I/O. If projected GPU time is high, inspect its associated kernels in the Nsight UI or add a kernel-specific report in a separate analysis step.