Skip to content

Commit cf46653

Browse files
FindHaometa-codesync[bot]
authored andcommitted
Move wiki content to docs/ and add GitHub Action for wiki sync
Summary: Move all GitHub Wiki pages into docs/ directory in the main repo so documentation is version-controlled alongside code and goes through code review. Changes: - Add docs/ directory with all wiki pages (Home, Installation, Usage Guide, Web Interface Guide, Developer Guide, Code Formatting, FAQ, Environment Variables Reference, Python API Reference, Reproducer Guide) - Add docs/_Sidebar.md for wiki sidebar navigation - Internal cross-references updated to use .md extensions (works in GitHub markdown renderer) - Add .github/workflows/sync-wiki.yml GitHub Action that syncs docs/ to the wiki on push to main, stripping .md extensions from links for wiki compatibility - Fix deprecated TRITON_TRACE_GZIP references → TRITON_TRACE_COMPRESSION across all docs - Add missing environment variables: TRITON_TRACE_LAUNCH_WITHIN_PROFILING, TRITON_TRACE_COMPRESSION, TRITONPARSE_TENSOR_SAVE_SKIP_RUNS, TRITONPARSE_TENSOR_SAVE_MAX_RUNS - Update Python API signatures for init(), TritonParseManager, reproduce(), unified_parse() with new parameters - Add documentation for diff, bisect, and compat-build CLI subcommands - Update project structure in Developer Guide to reflect current codebase - Fix outdated test commands: replace pytest and python -m unittest tests.test_tritonparse with make test / make test-cuda (matching CI run-tests.sh) - Update Makefile test targets from pytest to python -m unittest discover Reviewed By: xuzhao9 Differential Revision: D102010588 fbshipit-source-id: 1e0236707ddb8d18cb784af9305b2ea61fb72e8a
1 parent f37ba41 commit cf46653

13 files changed

Lines changed: 5031 additions & 2 deletions

.github/workflows/sync-wiki.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Sync docs to Wiki
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "docs/**"
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
sync-wiki:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout main repo
18+
uses: actions/checkout@v4
19+
20+
- name: Checkout wiki repo
21+
uses: actions/checkout@v4
22+
with:
23+
repository: ${{ github.repository }}.wiki
24+
path: wiki
25+
token: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Sync docs to wiki
28+
run: |
29+
# Copy all docs files into the wiki checkout
30+
rsync -av --delete --exclude '.git' docs/ wiki/
31+
32+
# Transform links: strip .md extension from internal wiki-style links
33+
# e.g., (01.-Installation.md) -> (01.-Installation)
34+
# e.g., (01.-Installation.md#anchor) -> (01.-Installation#anchor)
35+
cd wiki
36+
for f in *.md; do
37+
sed -i -E 's/\]\(([0-9]{2}\.-[A-Za-z0-9_-]+)\.md(#[^)]*)?)/](\1\2)/g' "$f"
38+
done
39+
40+
- name: Push to wiki
41+
run: |
42+
cd wiki
43+
git config user.name "github-actions[bot]"
44+
git config user.email "github-actions[bot]@users.noreply.github.com"
45+
git add -A
46+
if git diff --cached --quiet; then
47+
echo "No changes to sync"
48+
else
49+
git commit -m "Sync docs from main repo ($(date -u +%Y-%m-%dT%H:%M:%SZ))"
50+
git push
51+
fi

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ format-check:
3131
# Testing targets
3232
test:
3333
@echo "Running tests (CPU only)..."
34-
pytest tests/ -v -m "not cuda"
34+
python -m unittest discover -s tests/cpu -t . -v
3535

3636
test-cuda:
3737
@echo "Running all tests (including CUDA)..."
38-
pytest tests/ -v
38+
python -m unittest discover -s tests -t . -v
3939

4040
# Utility targets
4141
clean:

docs/01.-Installation.md

Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
This guide covers all installation scenarios for TritonParse, from basic usage to full development setup.
2+
3+
## 📋 Prerequisites
4+
5+
### System Requirements
6+
- **Python** >= 3.10
7+
- **Operating System**: Linux, macOS, or Windows (with WSL recommended)
8+
- **GPU Required** (Triton depends on GPU):
9+
- **NVIDIA GPUs**: CUDA 11.8+
10+
- **AMD GPUs**: ROCm 5.0+ (supports MI100, MI200, MI300 series)
11+
- **Node.js** >= 22.0.0 (for website development only)
12+
13+
> ⚠️ **Important**: GPU is required to generate traces because Triton kernels can only run on GPU hardware. The web interface can view existing traces without GPU.
14+
15+
---
16+
17+
## 🔧 Install Required Dependencies
18+
19+
All installation options require PyTorch and Triton. Complete these steps first before choosing your installation option below.
20+
21+
### Step 1: Install PyTorch with GPU Support
22+
23+
#### For NVIDIA GPUs (CUDA)
24+
```bash
25+
# Install PyTorch nightly with CUDA 12.8 support (recommended)
26+
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/cu128
27+
28+
# Alternative: Install stable PyTorch with CUDA support
29+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
30+
```
31+
32+
#### For AMD GPUs (ROCm)
33+
```bash
34+
# Install PyTorch nightly with ROCm support (recommended)
35+
pip install --pre torch torchvision torchaudio --index-url https://download.pytorch.org/whl/nightly/rocm6.2
36+
37+
# Alternative: Install stable PyTorch with ROCm support
38+
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/rocm6.1
39+
```
40+
41+
### Step 2: Verify GPU Setup
42+
```bash
43+
# Verify PyTorch and GPU
44+
python -c "import torch; print(f'PyTorch: {torch.__version__}')"
45+
python -c "import torch; print(f'GPU available: {torch.cuda.is_available()}')"
46+
python -c "import torch; print(f'GPU device: {torch.cuda.get_device_name(0) if torch.cuda.is_available() else \"No GPU\"}')"
47+
48+
# Verify Triton (bundled with PyTorch)
49+
python -c "import triton; print(f'Triton: {triton.__version__}')"
50+
```
51+
52+
> 💡 **Note**: Triton is bundled with PyTorch nightly and recent stable releases. No separate installation is needed.
53+
54+
---
55+
56+
## 🎯 Installation Options
57+
58+
Now choose your installation method based on your needs:
59+
60+
### Option 1: PyPI Installation (Recommended for Most Users)
61+
**Quick installation from Python Package Index**
62+
63+
```bash
64+
# Install nightly version (recommended, latest features)
65+
pip install -U --pre tritonparse
66+
67+
# OR install stable version
68+
pip install tritonparse
69+
```
70+
71+
### Option 2: Install from Source
72+
73+
```bash
74+
# Clone and install
75+
git clone https://github.com/meta-pytorch/tritonparse.git
76+
cd tritonparse
77+
pip install -e .
78+
79+
# OR install directly from GitHub without cloning
80+
pip install git+https://github.com/meta-pytorch/tritonparse.git
81+
```
82+
83+
**Additional setup for contributors:**
84+
85+
```bash
86+
# For Python development: install formatting tools (black, usort, ruff)
87+
make install-dev
88+
89+
# For website development: install Node.js dependencies (requires Node.js >= 22.0.0)
90+
cd website && npm install
91+
npm run dev # Start dev server at http://localhost:5173
92+
```
93+
94+
---
95+
96+
## ✅ Verify Installation
97+
98+
Test that TritonParse is working correctly:
99+
100+
```bash
101+
# Navigate to tests directory
102+
cd tests # or cd tritonparse/tests if you didn't clone
103+
104+
# Run example test
105+
TORCHINDUCTOR_FX_GRAPH_CACHE=0 python test_add.py
106+
```
107+
108+
**Expected output:**
109+
```bash
110+
Triton kernel executed successfully
111+
Torch compiled function executed successfully
112+
================================================================================
113+
📁 TRITONPARSE PARSING RESULTS
114+
================================================================================
115+
📂 Parsed files directory: /scratch/findhao/tritonparse/tests/parsed_output
116+
📊 Total files generated: 2
117+
...
118+
✅ Parsing completed successfully!
119+
================================================================================
120+
```
121+
122+
### Using the Web Interface
123+
1. Generate trace files using the Python API (see [Usage Guide](02.-Usage-Guide.md))
124+
2. Visit [https://meta-pytorch.org/tritonparse/](https://meta-pytorch.org/tritonparse/)
125+
3. Load your trace files (.ndjson or .gz format)
126+
127+
### Additional Commands for Development
128+
129+
**For Python development (Option 3):**
130+
```bash
131+
# Check code formatting
132+
make format-check
133+
134+
# Run linting
135+
make lint-check
136+
137+
# Run tests
138+
make test
139+
```
140+
141+
**For website development (Option 4):**
142+
```bash
143+
npm run dev # Development server
144+
npm run build # Production build
145+
npm run build:single # Standalone HTML build
146+
npm run preview # Preview production build
147+
```
148+
149+
---
150+
151+
## 🐛 Troubleshooting
152+
153+
### Common Issues
154+
155+
#### 1. GPU Not Available
156+
**Error:** "CUDA not available" or "ROCm not available"
157+
158+
**Diagnosis:**
159+
```bash
160+
python -c "import torch; print(f'GPU available: {torch.cuda.is_available()}')"
161+
python -c "import torch; print(f'Device count: {torch.cuda.device_count()}')"
162+
```
163+
164+
**Solution:** Reinstall PyTorch with GPU support following [Step 1](#step-1-install-pytorch-with-gpu-support) above.
165+
166+
#### 2. Triton Installation Issues
167+
**Error:** "No module named 'triton'" or "Triton version mismatch"
168+
169+
**Solution:**
170+
```bash
171+
pip uninstall -y pytorch-triton triton || true
172+
pip install --upgrade triton
173+
```
174+
175+
#### 3. Permission Issues
176+
**Error:** Permission denied during installation
177+
178+
**Solution:** Use a virtual environment
179+
```bash
180+
python -m venv tritonparse-env
181+
source tritonparse-env/bin/activate # Linux/Mac
182+
# OR
183+
tritonparse-env\Scripts\activate # Windows
184+
```
185+
186+
#### 4. Development Tools Not Found
187+
**Error:** "black not found" or similar
188+
189+
**Solution:**
190+
```bash
191+
make install-dev
192+
# OR manually: pip install black usort ruff
193+
```
194+
195+
#### 5. Website Build Issues
196+
**Error:** Node.js version too old
197+
198+
**Solution:**
199+
```bash
200+
# Update Node.js to >= 22.0.0
201+
conda install 'nodejs>=22.0.0' -c conda-forge
202+
203+
# Clear cache and reinstall
204+
rm -rf node_modules package-lock.json
205+
npm install
206+
```
207+
208+
### Useful Environment Variables
209+
210+
> 💡 **See [Environment Variables Reference](07.-Environment-Variables-Reference.md)** for complete documentation of all variables.
211+
212+
```bash
213+
# TritonParse
214+
export TRITONPARSE_DEBUG=1 # Enable debug logging
215+
export TRITON_TRACE_COMPRESSION=gzip # Enable gzip compression
216+
export TRITON_TRACE=/path/to/traces # Custom trace directory
217+
export TRITON_TRACE_LAUNCH=1 # Enable launch tracing
218+
export TRITONPARSE_MORE_TENSOR_INFORMATION=1 # Collect tensor statistics
219+
220+
# PyTorch/TorchInductor
221+
export TORCHINDUCTOR_FX_GRAPH_CACHE=0 # Disable FX graph cache (for testing)
222+
export TORCH_LOGS="+dynamo,+inductor" # Enable PyTorch debug logs
223+
224+
# GPU control
225+
export CUDA_VISIBLE_DEVICES=0 # Limit to specific GPU (NVIDIA)
226+
export ROCR_VISIBLE_DEVICES=0 # Limit to specific GPU (AMD)
227+
export CUDA_LAUNCH_BLOCKING=1 # Synchronous CUDA execution (for debugging)
228+
```
229+
230+
### Getting Help
231+
232+
If you encounter issues:
233+
234+
1. Check the [Troubleshooting section](#-troubleshooting) above
235+
2. Review the [FAQ](06.-FAQ.md) for frequently asked questions
236+
3. Search [GitHub Issues](https://github.com/meta-pytorch/tritonparse/issues)
237+
4. Open a new issue with system info (`python --version`, `pip list`) and error messages
238+
239+
---
240+
241+
## 🚀 Next Steps
242+
243+
After successful installation:
244+
245+
1. **Read the [Usage Guide](02.-Usage-Guide.md)** to learn how to generate traces
246+
2. **Explore the [Web Interface Guide](03.-Web-Interface-Guide.md)** to master the visualization
247+
3. **Check out [Basic Examples](02.-Usage-Guide.md#example-complete-triton-kernel)** for practical usage scenarios
248+
4. **Review the [Environment Variables Reference](07.-Environment-Variables-Reference.md)** for configuration options
249+
5. **See the [Python API Reference](08.-Python-API-Reference.md)** for complete API documentation
250+
6. **Join the [GitHub Discussions](https://github.com/meta-pytorch/tritonparse/discussions)** for community support

0 commit comments

Comments
 (0)