nano-triton
A from-scratch nano-Triton (newt) and nano-Helion (deuteron): the modern
GPU-kernel DSL stack, rebuilt in ~4,000 lines of readable Python, reaching
memory-bandwidth parity with real Triton and 80%+ of its tensor-core matmul
throughput. No dependencies beyond torch.
- newt is a nano-Triton:
@newt.jitkernels compile Python AST to CUDA C++ to NVRTC to a cubin, launched through the raw CUDA driver API via ctypes. No MLIR, no LLVM, no nvcc. - deuteron is a nano-Helion: write PyTorch-like tile code with no kernel details; it generates a newt kernel and autotunes it against an eager-PyTorch correctness oracle.
Install
pip install nano-triton
Requires torch and an NVIDIA GPU with the CUDA toolkit (newt uses NVRTC to
compile kernels at runtime). Installing the package gives you both import newt
and import deuteron.
Quick start
import torch
import newt
import newt.language as nl
@newt.jit
def add_kernel(x_ptr, y_ptr, out_ptr, n, BLOCK: nl.constexpr):
pid = nl.program_id(0)
offs = pid * BLOCK + nl.arange(0, BLOCK)
mask = offs < n
x = nl.load(x_ptr + offs, mask=mask)
y = nl.load(y_ptr + offs, mask=mask)
nl.store(out_ptr + offs, x + y, mask=mask)
x, y = torch.randn(2, 1_000_000, device="cuda")
out = torch.empty_like(x)
add_kernel[lambda m: (newt.cdiv(1_000_000, m["BLOCK"]),)](
x, y, out, 1_000_000, BLOCK=1024)
Benchmarks
RTX PRO 5000 Blackwell laptop GPU, same kernel source and tuning sweep for newt and real Triton. fp16 tensor-core matmul, sustained same-run medians:
| TFLOP/s | 1024 | 2048 | 4096 | 8192 |
|---|---|---|---|---|
| nano-triton | 67 | 83 | 82 | 77 |
| triton | 81 | 101 | 119 | 101 |
That is 76 to 83 percent of Triton sustained, and about 92 percent cold. Memory-bound kernels (softmax, layernorm, elementwise) match Triton at the memory-bandwidth ceiling.
Docs and source
- Full writeup, from-zero explainer, benchmarks, glossary: https://arpitsinghgautam.me/nano-triton/
- Source and issues: https://github.com/arpitsinghgautam/nano-triton
MIT licensed.
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 nano_triton-0.1.0.tar.gz.
File metadata
- Download URL: nano_triton-0.1.0.tar.gz
- Upload date:
- Size: 71.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f280ac980b2c04924f5d205bf56f11937df43c827b6feffd760402a657e376e3
|
|
| MD5 |
ff9b4d13427d67f50ffa86680b61e50f
|
|
| BLAKE2b-256 |
d3ba51f72af85d7e7f1a569e66eeec3d5d9d39267abda712f47ed0d5e7d7ea65
|
Provenance
The following attestation bundles were made for nano_triton-0.1.0.tar.gz:
Publisher:
publish.yml on arpitsinghgautam/nano-triton
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nano_triton-0.1.0.tar.gz -
Subject digest:
f280ac980b2c04924f5d205bf56f11937df43c827b6feffd760402a657e376e3 - Sigstore transparency entry: 2247820032
- Sigstore integration time:
-
Permalink:
arpitsinghgautam/nano-triton@731c5c196575d801ba6b78f34ad0391a56b5c177 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/arpitsinghgautam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@731c5c196575d801ba6b78f34ad0391a56b5c177 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file nano_triton-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nano_triton-0.1.0-py3-none-any.whl
- Upload date:
- Size: 56.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f30a8735024324a989adbb403692732898c9bae8120234c1c958626018a54d05
|
|
| MD5 |
9e7b2757d385486ebda83990232657f9
|
|
| BLAKE2b-256 |
00f128dab8e8218205da74967eac204d4030109800231ea6cd91336c29376340
|
Provenance
The following attestation bundles were made for nano_triton-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on arpitsinghgautam/nano-triton
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nano_triton-0.1.0-py3-none-any.whl -
Subject digest:
f30a8735024324a989adbb403692732898c9bae8120234c1c958626018a54d05 - Sigstore transparency entry: 2247820314
- Sigstore integration time:
-
Permalink:
arpitsinghgautam/nano-triton@731c5c196575d801ba6b78f34ad0391a56b5c177 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/arpitsinghgautam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@731c5c196575d801ba6b78f34ad0391a56b5c177 -
Trigger Event:
workflow_dispatch
-
Statement type: