Skip to main content

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.

nano-triton

  • newt is a nano-Triton: @newt.jit kernels 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

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

nano_triton-0.1.0.tar.gz (71.1 kB view details)

Uploaded Source

Built Distribution

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

nano_triton-0.1.0-py3-none-any.whl (56.3 kB view details)

Uploaded Python 3

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

Hashes for nano_triton-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f280ac980b2c04924f5d205bf56f11937df43c827b6feffd760402a657e376e3
MD5 ff9b4d13427d67f50ffa86680b61e50f
BLAKE2b-256 d3ba51f72af85d7e7f1a569e66eeec3d5d9d39267abda712f47ed0d5e7d7ea65

See more details on using hashes here.

Provenance

The following attestation bundles were made for nano_triton-0.1.0.tar.gz:

Publisher: publish.yml on arpitsinghgautam/nano-triton

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

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

Hashes for nano_triton-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f30a8735024324a989adbb403692732898c9bae8120234c1c958626018a54d05
MD5 9e7b2757d385486ebda83990232657f9
BLAKE2b-256 00f128dab8e8218205da74967eac204d4030109800231ea6cd91336c29376340

See more details on using hashes here.

Provenance

The following attestation bundles were made for nano_triton-0.1.0-py3-none-any.whl:

Publisher: publish.yml on arpitsinghgautam/nano-triton

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 Sentry Error logging StatusPage Status page