Add repository documentation
Browse files
README.md
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
title: Triton Windows Pre-built Binaries
|
| 4 |
+
sdk: static
|
| 5 |
+
emoji: ⚡
|
| 6 |
+
colorFrom: blue
|
| 7 |
+
colorTo: green
|
| 8 |
+
tags:
|
| 9 |
+
- triton
|
| 10 |
+
- windows
|
| 11 |
+
- cuda
|
| 12 |
+
- deep-learning
|
| 13 |
+
- gpu
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Triton for Windows - Pre-built Binaries
|
| 17 |
+
|
| 18 |
+
**Developed by Dr. Ankush Rai** | [GitHub](https://github.com/RaiAnk)
|
| 19 |
+
|
| 20 |
+
This repository hosts pre-built Windows binaries for [OpenAI Triton](https://github.com/triton-lang/triton), a language and compiler for writing highly efficient custom Deep-Learning primitives.
|
| 21 |
+
|
| 22 |
+
## Available Downloads
|
| 23 |
+
|
| 24 |
+
### Triton Wheels (Python)
|
| 25 |
+
|
| 26 |
+
| Python | CUDA | Wheel | Size |
|
| 27 |
+
|--------|------|-------|------|
|
| 28 |
+
| 3.11 | 12.x | `wheels/triton-3.2.0+windows-cp311-cp311-win_amd64.whl` | ~100MB |
|
| 29 |
+
|
| 30 |
+
### Pre-built LLVM (Optional)
|
| 31 |
+
|
| 32 |
+
If you want to build Triton from source or develop custom kernels:
|
| 33 |
+
|
| 34 |
+
| File | Description | Size |
|
| 35 |
+
|------|-------------|------|
|
| 36 |
+
| `llvm/llvm-triton-windows-x64.zip` | LLVM with MLIR support | ~800MB |
|
| 37 |
+
|
| 38 |
+
## Installation
|
| 39 |
+
|
| 40 |
+
### Quick Install
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
# 1. Download the wheel for your Python version
|
| 44 |
+
# 2. Install with pip:
|
| 45 |
+
pip install triton-3.2.0+windows-cp311-cp311-win_amd64.whl
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
### Using the Installer Script
|
| 49 |
+
|
| 50 |
+
```bash
|
| 51 |
+
# Clone the source repository
|
| 52 |
+
git clone https://github.com/RaiAnk/triton-windows.git
|
| 53 |
+
cd triton-windows
|
| 54 |
+
|
| 55 |
+
# Run installer (downloads from this HuggingFace repo)
|
| 56 |
+
python install_triton_windows.py
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
## Requirements
|
| 60 |
+
|
| 61 |
+
- **Windows 10/11 x64**
|
| 62 |
+
- **Python 3.10, 3.11, or 3.12**
|
| 63 |
+
- **NVIDIA CUDA Toolkit 12.x**
|
| 64 |
+
- **PyTorch 2.4+ with CUDA support**
|
| 65 |
+
|
| 66 |
+
## Verify Installation
|
| 67 |
+
|
| 68 |
+
```python
|
| 69 |
+
import triton
|
| 70 |
+
import triton.language as tl
|
| 71 |
+
import torch
|
| 72 |
+
|
| 73 |
+
@triton.jit
|
| 74 |
+
def add_kernel(x_ptr, y_ptr, output_ptr, n_elements, BLOCK_SIZE: tl.constexpr):
|
| 75 |
+
pid = tl.program_id(axis=0)
|
| 76 |
+
block_start = pid * BLOCK_SIZE
|
| 77 |
+
offsets = block_start + tl.arange(0, BLOCK_SIZE)
|
| 78 |
+
mask = offsets < n_elements
|
| 79 |
+
x = tl.load(x_ptr + offsets, mask=mask)
|
| 80 |
+
y = tl.load(y_ptr + offsets, mask=mask)
|
| 81 |
+
output = x + y
|
| 82 |
+
tl.store(output_ptr + offsets, output, mask=mask)
|
| 83 |
+
|
| 84 |
+
# Test
|
| 85 |
+
size = 1024
|
| 86 |
+
x = torch.rand(size, device='cuda')
|
| 87 |
+
y = torch.rand(size, device='cuda')
|
| 88 |
+
output = torch.empty_like(x)
|
| 89 |
+
|
| 90 |
+
grid = lambda meta: (triton.cdiv(size, meta['BLOCK_SIZE']),)
|
| 91 |
+
add_kernel[grid](x, y, output, size, BLOCK_SIZE=256)
|
| 92 |
+
|
| 93 |
+
print("Triton is working!" if torch.allclose(output, x + y) else "Error!")
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
## Source Code
|
| 97 |
+
|
| 98 |
+
The modified Triton source code with Windows support is available at:
|
| 99 |
+
- **GitHub**: https://github.com/RaiAnk/triton-windows
|
| 100 |
+
|
| 101 |
+
## Build from Source
|
| 102 |
+
|
| 103 |
+
If you need to build from source (for unsupported Python versions or custom modifications):
|
| 104 |
+
|
| 105 |
+
1. Download pre-built LLVM from this repository
|
| 106 |
+
2. Extract to `C:\llvm-triton`
|
| 107 |
+
3. Set environment variables:
|
| 108 |
+
```cmd
|
| 109 |
+
set LLVM_SYSPATH=C:\llvm-triton
|
| 110 |
+
set LLVM_LIBRARY_DIR=C:\llvm-triton\lib
|
| 111 |
+
set LLVM_INCLUDE_DIRS=C:\llvm-triton\include
|
| 112 |
+
```
|
| 113 |
+
4. Build Triton:
|
| 114 |
+
```cmd
|
| 115 |
+
pip install -e .
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
## Known Limitations
|
| 119 |
+
|
| 120 |
+
- AMD ROCm is not supported on Windows
|
| 121 |
+
- Some advanced features may have limited functionality
|
| 122 |
+
- Proton profiler has limited Windows support
|
| 123 |
+
|
| 124 |
+
## License
|
| 125 |
+
|
| 126 |
+
Triton is licensed under the MIT License. See the [original repository](https://github.com/triton-lang/triton) for details.
|
| 127 |
+
|
| 128 |
+
## Credits
|
| 129 |
+
|
| 130 |
+
- **Original Triton**: OpenAI and the Triton team
|
| 131 |
+
- **Windows Port**: Dr. Ankush Rai
|
| 132 |
+
|
| 133 |
+
## Support
|
| 134 |
+
|
| 135 |
+
For issues with Windows support, please open an issue on the GitHub repository.
|