Skip to main content

TritonParse: A Compiler Tracer, Visualizer, and mini-Reproducer Generator for Triton Kernels

Project description

TritonParse

License: BSD-3 GitHub Pages

A comprehensive visualization and analysis tool for Triton kernel compilation and launch โ€” helping developers analyze, debug, and understand Triton kernel compilation processes.

๐ŸŒ Try it online โ†’

โœจ Key Features

๐Ÿ” Visualization & Analysis

  • ๐Ÿš€ Launch Difference Analysis - Detect and visualize kernel launch parameter variations
  • ๐Ÿ“Š IR Code View - Side-by-side IR viewing with synchronized highlighting and line mapping
  • ๐Ÿ”„ File Diff View - Compare kernels across different trace files side-by-side
  • ๐Ÿ“ Multi-format IR Support - View TTGIR, TTIR, LLIR, PTX, and AMDGCN
  • ๐ŸŽฏ Interactive Code Views - Click-to-highlight corresponding lines across IR stages

๐Ÿ”ง Reproducer & Debugging Tools

  • ๐Ÿ”„ Standalone Script Generation - Extract any kernel into a self-contained Python script
  • ๐Ÿ’พ Tensor Data Reconstruction - Preserve actual tensor data or use statistical approximation
  • ๐ŸŽฏ Custom Templates - Flexible reproducer templates for different workflows
  • ๐Ÿ› Bug Isolation - Share reproducible test cases for debugging and collaboration

๐Ÿ“Š Structured Logging & Analysis

  • ๐Ÿ“ Compilation & Launch Tracing - Capture detailed events with source mapping
  • ๐Ÿ” Stack Trace Integration - Full Python stack traces for debugging
  • ๐Ÿ“ˆ Metadata Extraction - Comprehensive kernel statistics

๐Ÿ› ๏ธ Developer Tools

  • ๐ŸŒ Browser-based Interface - No installation required, works in your browser
  • ๐Ÿ”’ Privacy-first - All processing happens locally, no data uploaded

๐Ÿš€ Quick Start

1. Installation

Four options to install:

# install nightly version
pip install -U --pre tritonparse
# install stable version
pip install tritonparse
# install from source
git clone https://github.com/meta-pytorch/tritonparse.git
cd tritonparse
pip install -e .
# pip install the latest version from github
pip install git+https://github.com/meta-pytorch/tritonparse.git

Prerequisites: Python โ‰ฅ 3.10, Triton โ‰ฅ 3.4.0, GPU required (NVIDIA/AMD)

TritonParse relies on new features in Triton. If you're using nightly PyTorch, Triton is already included. Otherwise, install the latest Triton:

pip install triton

2. Generate Traces

import tritonparse.structured_logging
import tritonparse.parse.utils

# Initialize logging with full tracing options
tritonparse.structured_logging.init(
    "./logs/",
    enable_trace_launch=True,                 # Capture kernel launch events (enables torch.compile tracing automatically)
    enable_more_tensor_information=True,      # Optional: collect tensor statistics (min/max/mean/std)
)

# Your Triton/PyTorch code here
# ... your kernels ...

# Parse and generate trace files
tritonparse.parse.utils.unified_parse("./logs/", out="./parsed_output")

๐Ÿ’ก Note: enable_trace_launch=True automatically enables tracing for both native Triton kernels (@triton.jit) and torch.compile / TorchInductor kernels.

๐Ÿ“ Example output (click to expand)
================================================================================
๐Ÿ“ TRITONPARSE PARSING RESULTS
================================================================================
๐Ÿ“‚ Parsed files directory: /scratch/findhao/tritonparse/tests/parsed_output
๐Ÿ“Š Total files generated: 2

๐Ÿ“„ Generated files:
   1. ๐Ÿ“ dedicated_log_triton_trace_findhao__mapped.ndjson.gz (7.2KB)
   2. ๐Ÿ“ log_file_list.json (181B)
================================================================================
โœ… Parsing completed successfully!
================================================================================

3. Visualize Results

Visit https://meta-pytorch.org/tritonparse/ and open your local trace files (.ndjson.gz format).

๐Ÿ”’ Privacy Note: Your trace files are processed entirely in your browser - nothing is uploaded to any server!

4. Generate Reproducers (Optional)

Extract any kernel into a standalone, executable Python script for debugging or testing:

# Generate reproducer for the first launch event
# (--line is 0-based: line 0 is compilation event, line 1 is first launch event)
tritonparseoss reproduce ./parsed_output/trace.ndjson.gz --line 1 --out-dir repro_output

# Run the generated reproducer
cd repro_output/<kernel_name>/
python repro_*.py

Python API:

from tritonparse.reproducer.orchestrator import reproduce

result = reproduce(
    input_path="./parsed_output/trace.ndjson.gz",
    line_index=0,           # 0-based index (first event is 0)
    out_dir="repro_output"
)
๐ŸŽฏ Common Reproducer Use Cases (click to expand)
  • ๐Ÿ› Bug Isolation: Extract a failing kernel into a minimal standalone script
  • โšก Performance Testing: Benchmark specific kernels without running the full application
  • ๐Ÿค Team Collaboration: Share reproducible test cases with colleagues or in bug reports
  • ๐Ÿ“Š Regression Testing: Compare kernel behavior and performance across different versions
  • ๐Ÿ” Deep Debugging: Modify and experiment with kernel parameters in isolation

๐Ÿ“š Complete Documentation

๐Ÿ“– Guide Description
๐Ÿ  Wiki Home Complete documentation and quick navigation
๐Ÿ“ฆ Installation Setup guide for all scenarios
๐Ÿ“‹ Usage Guide Complete workflow, reproducer generation, and examples
๐ŸŒ Web Interface Master the visualization interface
๐Ÿ”ง Developer Guide Contributing and architecture overview
๐Ÿ“ Code Formatting Formatting standards and tools
โ“ FAQ Quick answers and troubleshooting
โš™๏ธ Environment Variables Complete environment variable reference
๐Ÿ“– Python API Reference Full API documentation
๐Ÿ”„ Reproducer Guide Comprehensive kernel reproducer guide

๐Ÿ“Š Understanding Triton Compilation

TritonParse visualizes the complete Triton compilation pipeline:

Python Source โ†’ TTIR โ†’ TTGIR โ†’ LLIR โ†’ PTX/AMDGCN

Each stage can be inspected and compared to understand optimization transformations.

๐Ÿค Contributing

We welcome contributions! Please see our Developer Guide for:

  • Development setup and prerequisites
  • Code formatting standards (Formatting Guide)
  • Pull request and code review process
  • Testing guidelines
  • Architecture overview

๐Ÿ“ž Support & Community

๐Ÿ“„ License

This project is licensed under the BSD-3 License - see the LICENSE file for details.


โœจ Ready to get started? Visit our Installation Guide or try the online tool directly!

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tritonparse-0.4.1.dev20260203072730.tar.gz (637.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tritonparse-0.4.1.dev20260203072730-py3-none-any.whl (197.0 kB view details)

Uploaded Python 3

File details

Details for the file tritonparse-0.4.1.dev20260203072730.tar.gz.

File metadata

File hashes

Hashes for tritonparse-0.4.1.dev20260203072730.tar.gz
Algorithm Hash digest
SHA256 9da8478f2bae7e4524fb30597c7e1cf6595ad5e2a63ce2dddd62ea7e5b93d813
MD5 756acffffb00c4452e5148e725a49e55
BLAKE2b-256 05d1fb311847fc087c4d5b86c00754970a57fc58c91eea05c3e02bc0ddcc19d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for tritonparse-0.4.1.dev20260203072730.tar.gz:

Publisher: nightly-pypi.yml on meta-pytorch/tritonparse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tritonparse-0.4.1.dev20260203072730-py3-none-any.whl.

File metadata

File hashes

Hashes for tritonparse-0.4.1.dev20260203072730-py3-none-any.whl
Algorithm Hash digest
SHA256 73bdfa80c754af3074498b1f57ba7ab1708d774edd7fcc0ab773a71cac80b470
MD5 3124f7aa975e337b69ccce9570eb199b
BLAKE2b-256 c46e35748e8d8bcdb8a69704beada07faf76c9c84041ea6050c0dafadfad7f72

See more details on using hashes here.

Provenance

The following attestation bundles were made for tritonparse-0.4.1.dev20260203072730-py3-none-any.whl:

Publisher: nightly-pypi.yml on meta-pytorch/tritonparse

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page