Skip to main content

triton-mla

A fused decode kernel for DeepSeek's Multi-head Latent Attention, the attention used in DeepSeek-V2, V3 and R1. It is written in Triton, OpenAI's Python language for writing GPU kernels. torch.compile still runs MLA as several separate GPU operations and writes the full attention-score matrix to memory between them. This kernel does the whole step in one pass over the compressed KV cache, so at long contexts it runs up to 3.6x faster on an H100.

Speedup over torch.compile

Achieved TFLOPS

Details

  • Setup: H100 80GB SXM, 128 heads (DeepSeek-V3 on one GPU), bf16, paged KV cache. torch.compile runs in max-autotune mode. Every case is checked against a reference before it is timed.
  • Results: faster than torch.compile in 15 of 16 shapes, peaking at 249 TFLOPS. The one loss is batch 8 at 1K tokens, where launch overhead dominates. At batch 32 and above, torch.compile was no faster than plain PyTorch. Full numbers are in results/bench_h100.csv.
  • Install: pip install git+https://github.com/luvadlamudi/triton-mla.git. The package provides mla_decode, a full MLA layer and the triton-mla-bench command.
  • Limitations: single-token decode only, no FP8 cache, and no Blackwell (B200) support yet.

Metadata

Release files for triton-mla 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for triton-mla 0.1.0
File Size Uploaded Provenance Actions
triton_mla-0.1.0.tar.gz 13.0 kB Without provenance Details for triton_mla-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for triton-mla 0.1.0
File Interpreter ABI Platform Actions
triton_mla-0.1.0-py3-none-any.whl Python 3 none any Details for triton_mla-0.1.0-py3-none-any.whl

Total release size: 25.2 kB

Release files / triton_mla-0.1.0.tar.gz

Download URL triton_mla-0.1.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
a0eb06a536c9c1cb8edc354b7b6aff233141db15cbd457170bdbc99c6ee24292
BLAKE2b-256 checksum
How to use checksums
f2de519d06e22721c0d10edf1bc69b732447f9c4d9747d54ff4b6f3d3873d6b1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Release files / triton_mla-0.1.0-py3-none-any.whl

Download URL triton_mla-0.1.0-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
459f62f89faa23d2206fd08e509f1bbf4fe4ad2b773dc0a59e27b816251391e8
BLAKE2b-256 checksum
How to use checksums
0e3546ae0168827119755ae12780ef8555695d8c065d61a4f4fdd49a449b5ccd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.1

Security for triton-mla 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page