TraceLens API reference#
2026-07-21
6 min read time
TraceLens exposes two complementary interfaces:
A set of command-line tools (installed as
console_scripts) for generating and comparing reports.A Python SDK for building custom analysis workflows.
This topic documents the command-line tools and their main arguments, and
summarizes the SDK modules. Run any tool with --help for the complete,
version-specific argument list.
Command-line tools#
The following sections document each tool’s main arguments and expected output.
TraceLens_generate_perf_report_pytorch#
Generate a multi-sheet Excel report from a PyTorch (torch.profiler) trace.
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to the |
|
auto |
Path to the output Excel file. |
|
None |
Directory to write per-sheet CSV files instead of/with Excel. |
|
off |
Add a kernel-summary sheet. |
|
off |
Add a short-kernel study; tune with |
|
on |
Disable the collective-analysis section (enabled by default). |
|
off |
Include kernels with no linked CPU op in the GPU-timeline analysis. |
|
None |
Threshold (µs) to classify an idle interval as micro-idle. |
|
None |
Second trace to compare against; runs TraceDiff and adds speedup/delta/LCA columns plus a |
|
off |
Use Origami for simulated GEMM/SDPA times when a GPU arch JSON is provided. |
|
off |
Detect activation recomputation and add an |
|
off |
Add kernel-overlap sheets. |
|
None |
Limit rows in the unique-args and roofline tables. |
|
None |
Custom extensions for |
Output: an .xlsx workbook with the GPU-timeline, operator-category,
operator, unique-argument, and roofline sheets.
TraceLens_generate_perf_report_pytorch_inference#
Inference-oriented variant of the PyTorch report.
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to the trace. |
|
off |
Group kernel-launcher summaries by parent |
|
None |
Path to the capture-trace folder. |
|
off |
Add |
Shares most options with TraceLens_generate_perf_report_pytorch (output
paths, short-kernel study, roofline/Origami, comparison, call stack). Run with
--help for the full list.
TraceLens_generate_perf_report_jax#
Generate a report from a JAX XPlane protobuf trace (also accepts a PyTorch trace).
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to the trace ( |
|
auto |
Output Excel file. |
|
None |
Directory for CSV output. |
|
None |
Only analyze events whose metadata contains the given keyword(s), for example |
|
off |
Use Origami simulated GEMM/SDPA times when a GPU arch JSON is provided. |
TraceLens_generate_perf_report_rocprof#
Generate a report from a rocprofv3 *_results.json trace.
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to the rocprofv3 |
|
auto / None |
Output destinations. |
|
off |
Include per-kernel detail with grid/block dimensions. |
|
on |
Disable kernel-summary sheets (enabled by default). |
|
off |
Add short-kernel analysis; tune with |
|
all |
Limit kernel details to the top K kernels by time. |
TraceLens_compare_perf_reports_pytorch#
Compare two or more previously generated reports.
Argument |
Default |
Description |
|---|---|---|
|
required |
One or more TraceLens reports: |
|
None |
Optional display tags for each report (count must match). |
|
|
Sheet groups to compare: |
|
|
Output Excel file. |
|
None |
Also write each comparison sheet as a CSV here. |
TraceLens_generate_multi_rank_collective_report_pytorch#
Generate a collective-communication report across ranks.
Argument |
Default |
Description |
|---|---|---|
|
— |
Directory containing per-rank trace files. |
|
— |
Template path with a single |
|
— |
Glob for arbitrarily named trace files (requires |
|
required |
Number of ranks. |
|
|
Aggregation metrics in the summary. |
|
auto |
Adds |
|
off |
Add an |
|
off / |
Parallel trace loading. |
--trace_dir, --trace_pattern, and --trace_glob are mutually exclusive
ways to locate the per-rank traces.
TraceLens_generate_perf_report_pftrace_hip_activity#
Per-GPU category and kernel/HIP/XLA activity report from a Perfetto-style trace.
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to |
|
off / None |
Write a Markdown report. |
|
off |
Merge kernel names by stripping digits. |
|
5000 |
Drop events shorter than this (ns). |
|
|
Baseline for the kernel summary. |
|
|
Grouping key for the kernel summary. |
|
off |
Include RCCL kernels in the kernel summary. |
|
auto |
Path to |
TraceLens_generate_perf_report_pftrace_hip_api#
HIP API ↔ kernel correlation with the latency breakdown T = A + Q + K (API
duration, queue delay, kernel duration).
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to |
|
auto / None |
Output destinations. |
|
redzone checker |
Regex of kernel names to exclude. |
|
off |
Allow multiple kernels per API correlation ID. |
|
off |
Include API rows that have no linked kernel. |
|
auto |
Path to |
TraceLens_generate_perf_report_pftrace_memory_copy#
Memory-copy report grouped by copy_bytes with direction and the GPUs
involved.
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to |
|
auto |
Custom Excel output path. |
|
None |
Directory for CSV output. |
|
auto |
Path to |
TraceLens_split_inference_trace#
Split an inference trace into per-iteration or per-phase sub-traces.
Argument |
Default |
Description |
|---|---|---|
|
required |
Path to the trace ( |
|
required |
Output directory. |
|
|
Iteration range: |
|
|
Dummy-run range. |
|
off / 32 |
Extract a steady-state region of N iterations. |
|
off |
Store steady-state steps into |
|
None |
Expected concurrency and output-sequence-length window parameters. |
Python SDK#
The SDK modules live under the TraceLens package and can be imported to build
custom workflows. Each module has a dedicated topic in the documentation and an
example notebook under examples/.
Module |
Purpose |
Reference |
|---|---|---|
|
Build and navigate the hierarchical event tree (Python ops → CPU dispatch → GPU kernels). |
|
|
GPU-timeline breakdown, per-op performance, and roofline metrics. |
Analyze traces with the TraceLens SDK, |
|
Compute and roofline performance models for operators. |
|
|
Multi-rank collective latency/bandwidth/skew analysis. |
Analyze collectives with NcclAnalyser, |
|
Morphological comparison of two trace trees. |
|
|
Extract and replay isolated operations. |
|
|
Merge multi-rank traces for Perfetto visualization. |
|
|
The report generators behind the CLI tools; importable to return pandas data frames. |
|
|
Trace utilities, including inference-trace splitting. |
— |
For report-column definitions across all sheets, see the Performance report column reference.
Note
For a class- and function-level SDK reference generated directly from docstrings, build the documentation against the TraceLens source with a Sphinx autodoc/autosummary extension.