Skip to main content

A compiler backend for PyTorch: pointwise fusion, buffer-reuse planning, and a persistent cross-run compile cache.

Project description

g2n

A compiler backend for PyTorch: pointwise fusion, buffer-reuse planning, and a persistent cross-run compile cache so repeat builds skip recompilation.

pip install g2n
import torch
import g2n

model = MyModule().eval()
compiled = g2n.compile(model)
# or register as a torch.compile backend:
compiled = torch.compile(model, backend="g2n")

A license key unlocks the Pro and Enterprise features (enhanced buffer planner, persistent cache, multi-accelerator routing, model-zoo configurations). See the documentation at https://g2n.dev/docs.

Custom kernels (Pro / Enterprise)

With a licensed tier, the g2n backend runs a real custom compile pass: it fuses LayerNorm (and a trailing GELU) into a Triton kernel via a torch.library custom op, then hands the rest of the graph to TorchInductor. See ARCHITECTURE.md. Correctness is covered by tests/test_layernorm.py; benchmark on your own GPU before quoting any speedup.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

g2n-0.5.1.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

g2n-0.5.1-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

Details for the file g2n-0.5.1.tar.gz.

File metadata

  • Download URL: g2n-0.5.1.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for g2n-0.5.1.tar.gz
Algorithm Hash digest
SHA256 9230c48d19d7aa2b32e2e54f4cb23a2f86007e55b363295a50b62d5a4927a3a1
MD5 1df162a5f2d1c724a2f29f4024337a85
BLAKE2b-256 6d905efe6f077b233a6758b8aba53b745af8b24dd74b781bbb9bd73849e6fc78

See more details on using hashes here.

File details

Details for the file g2n-0.5.1-py3-none-any.whl.

File metadata

  • Download URL: g2n-0.5.1-py3-none-any.whl
  • Upload date:
  • Size: 15.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for g2n-0.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 71d3fb317b08d1daf65c0ce50bcf51962f76e9af5642e6a21ebebdcba47a8cab
MD5 edf2f6de4d8695b1ca94b1474006f0e5
BLAKE2b-256 4830d0c96b7af8d2b4af98d3e894d66053eb40814d68dd9d0ecb21bdb1221125

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page