TritonParse: A Compiler Tracer, Visualizer, and mini-Reproducer Generator for Triton Kernels
Project description
TritonParse
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.utils
# Initialize logging
tritonparse.structured_logging.init("./logs/", enable_trace_launch=True)
# Your Triton/PyTorch code here
# ... your kernels ...
# Parse and generate trace files
tritonparse.utils.unified_parse("./logs/", out="./parsed_output")
๐ 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 from first launch event
tritonparseoss reproduce ./parsed_output/trace.ndjson.gz --line 2 --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 |
๐ 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
- ๐ Report Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ Documentation: TritonParse Wiki
๐ 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tritonparse-0.3.2.dev20251111071523.tar.gz.
File metadata
- Download URL: tritonparse-0.3.2.dev20251111071523.tar.gz
- Upload date:
- Size: 506.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4db7120ec1d484886abc57ed54a12b0f903a845b5d7d5eaf4035a5fa08a256e1
|
|
| MD5 |
cacf6055f9a34c64ee75364d924ff4ee
|
|
| BLAKE2b-256 |
67daca7e2fddb4b4401ec630558b8ca52bb48e8f791497e38f25a8f986206807
|
File details
Details for the file tritonparse-0.3.2.dev20251111071523-py3-none-any.whl.
File metadata
- Download URL: tritonparse-0.3.2.dev20251111071523-py3-none-any.whl
- Upload date:
- Size: 78.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7bc0baa714b2501c48d47939c92d678cea8c39a3b2a674772c0f837d4b630b5d
|
|
| MD5 |
455573ecee481fb9fd504b57b0300a31
|
|
| BLAKE2b-256 |
a623550bf9b41d6a8fa2b1638ac15ca031b4254536cdee72fafbb42caf25d427
|