TraceLens API reference

September 2, 2026 · View on GitHub

:description: Complete reference for TraceLens command-line tools and Python SDK modules, including arguments and output descriptions for all report generators.
:keywords: TraceLens, API reference, command-line tools, Python SDK, ROCm, GPU trace, performance report, PyTorch, JAX, rocprofv3, roofline, CLI

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.

ArgumentDefaultDescription
--profile_json_pathrequiredPath to the profile.json or .json.gz trace.
--output_xlsx_pathautoPath to the output Excel file.
--output_csvs_dirNoneDirectory to write per-sheet CSV files instead of or with Excel.
--enable_kernel_summaryoffAdd a kernel-summary sheet.
--short_kernel_studyoffAdd a short-kernel study; tune with --short_kernel_threshold_us, --short_kernel_histogram_bins, --topk_short_kernels.
--disable_coll_analysisonDisable the collective-analysis section (enabled by default).
--include_unlinked_kernelsoffInclude kernels with no linked CPU op in the GPU-timeline analysis.
--micro_idle_thresh_usNoneThreshold (µs) to classify an idle interval as micro-idle.
--comparison_json_pathNoneSecond trace to compare against; runs TraceDiff and adds speedup/delta/LCA columns plus a diff_stats sheet.
--enable-origamioffUse Origami for simulated GEMM/SDPA times when a GPU arch JSON is provided.
--detect_recomputeoffDetect activation recomputation and add an is_recompute column.
--include_overlap_infooffAdd kernel-overlap sheets.
--topk_ops, --topk_roofline_opsNoneLimit rows in the unique-args and roofline tables.
--extension_fileNoneCustom extensions for TraceTree and PerfModel.

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.

ArgumentDefaultDescription
--profile_json_pathrequiredPath to the trace.
--group_by_parent_moduleoffGroup kernel-launcher summaries by parent nn.Module.
--capture_folderNonePath to the capture-trace folder.
--include_overlap_infooffAdd *_kl_overlap sheets when data exists.

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).

ArgumentDefaultDescription
--profile_pathrequiredPath to the trace (trace.json or JAX xplane.pb).
--output_xlsx_pathautoOutput Excel file.
--output_csvs_dirNoneDirectory for CSV output.
--kernel_metadata_keyword_filtersNoneOnly analyze events whose metadata contains the given keyword(s), for example remat checkpoint.
--enable-origamioffUse 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.

ArgumentDefaultDescription
--profile_json_pathrequiredPath to the rocprofv3 *_results.json trace.
--output_xlsx_path / --output_csvs_dirauto / NoneOutput destinations.
--kernel_detailsoffInclude per-kernel detail with grid/block dimensions.
--disable_kernel_summaryonDisable kernel-summary sheets (enabled by default).
--short_kernel_studyoffAdd short-kernel analysis; tune with --short_kernel_threshold_us, --short_kernel_histogram_bins.
--topk_kernelsallLimit kernel details to the top K kernels by time.

TraceLens_compare_perf_reports_pytorch

Compare two or more previously generated reports.

ArgumentDefaultDescription
reportsrequiredOne or more TraceLens reports: .xlsx files or directories of per-sheet .csv files.
--namesNoneOptional display tags for each report (count must match).
--sheetsallSheet groups to compare: gpu_timeline, ops_summary, kernel_summary, ops_all, roofline, or all.
-o, --outputcomparison.xlsxOutput Excel file.
--output_csvs_dirNoneAlso write each comparison sheet as a CSV here.

TraceLens_generate_multi_rank_collective_report_pytorch

Generate a collective-communication report across ranks.

ArgumentDefaultDescription
--trace_dirDirectory containing per-rank trace files.
--trace_patternTemplate path with a single * placeholder for rank.
--trace_globGlob for arbitrarily named trace files (requires --world_size, uses --rank_regex).
--world_sizerequiredNumber of ranks.
--agg_metricsmean median min maxAggregation metrics in the summary.
--gpus_per_nodeautoAdds node_id/node_span columns and labels each process group intra_node or inter_node.
--all2allv_heatmapoffAdd an nccl_all2allv_heatmap sheet with per rank-pair send volumes.
--use_multiprocessing / --max_workersoff / cpu_countParallel 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.

ArgumentDefaultDescription
--trace_pathrequiredPath to .json, .json.gz, or .pftrace.
--write_md / --output_md_pathoff / NoneWrite a Markdown report.
--merge_kernelsoffMerge kernel names by stripping digits.
--min_event_ns5000Drop events shorter than this (ns).
--kernel_summary_baselinetotalBaseline for the kernel summary.
--kernel_summary_groupconfigGrouping key for the kernel summary.
--kernel_summary_include_rccloffInclude RCCL kernels in the kernel summary.
--traceconvautoPath to traceconv (auto-resolved or downloaded for .pftrace).

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).

ArgumentDefaultDescription
--trace_pathrequiredPath to .json, .json.gz, or .pftrace.
--output_xlsx_path / --output_csvs_dirauto / NoneOutput destinations.
--exclude_kernel_regexredzone checkerRegex of kernel names to exclude.
--allow_multi_kernel_per_apioffAllow multiple kernels per API correlation ID.
--include_nonlaunch_apisoffInclude API rows that have no linked kernel.
--traceconvautoPath to traceconv.

TraceLens_generate_perf_report_pftrace_memory_copy

Memory-copy report grouped by copy_bytes with direction and the GPUs involved.

ArgumentDefaultDescription
--trace_pathrequiredPath to .json, .json.gz, or .pftrace.
--output_xlsx_pathautoCustom Excel output path.
--output_csvs_dirNoneDirectory for CSV output.
--traceconvautoPath to traceconv.

TraceLens_split_inference_trace

Split an inference trace into per-iteration or per-phase sub-traces.

ArgumentDefaultDescription
trace_pathrequiredPath to the trace (.json or .json.gz).
-o, --output-dirrequiredOutput directory.
-i, --iterationsallIteration range: all, a single index (50), or a range (10:20).
--store-single-iterationoffWrite each iteration as a separate trace file.
--find-steady-state / --num-stepsoff / 32Extract a steady-state region of N iterations.
--divide-phasesoffStore steady-state steps into prefilldecodemix/ and decode_only/ sub-folders.
--CONC, --OSL, --RNoneExpected concurrency and output-sequence-length window parameters.

TraceLens_trace_index

Catalog profiler traces and TraceLens CSV reports into a searchable index. SQLite is the first backend; the tables are the shared catalog schema. See Index a corpus of traces for the full workflow.

Global options: --backend (default sqlite) and --db (default trace_index.sqlite).

CommandDescription
append --trace-path PATHAppend one trace. Pass --report-dir to load an existing CSV report; otherwise generate a training PyTorch report.
build --traces-file FILECreate or open the catalog and append a batch of traces (one path per line). Repeatable --trace-path is also accepted.
search TERMSFull-text search over indexed traces, ops, kernels, and categories.
sqlite-sql SQLRun one read-only SQL statement.

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/.

ModulePurposeReference
Trace2TreeBuild and navigate the hierarchical event tree (Python ops → CPU dispatch → GPU kernels).Trace2Tree data model, trace2tree_example.ipynb
TreePerfGPU-timeline breakdown, per-op performance, and roofline metrics.Analyze traces with the TraceLens SDK, tree_perf_example.ipynb
PerfModelCompute and roofline performance models for operators.GEMM analysis, Triton kernel performance model
NcclAnalyserMulti-rank collective latency/bandwidth/skew analysis.Analyze collectives with NcclAnalyser, nccl_analyser_example.ipynb
TraceDiffMorphological comparison of two trace trees.Compare two traces, trace_diff_example.ipynb
EventReplayExtract and replay isolated operations.Replay a single operation, event_replayer_example.ipynb
TraceFusionMerge multi-rank traces for Perfetto visualization.Fuse multi-rank traces, trace_fusion_example.py
ReportingThe report generators behind the CLI tools; importable to return pandas data frames.Generate a PyTorch performance report
TraceIndexCatalog traces into a searchable index (SQLite first backend).Index a corpus of traces
TraceUtilsTrace utilities, including inference-trace splitting.

For report-column definitions across all sheets, see the Performance report column reference.

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.