Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

sgl-fa3

The FlashAttention-3 forward kernels SGLang serves with, packaged as a standalone wheel. Until this package existed they were compiled into sglang-kernel as sgl_kernel.flash_ops.

The kernels come from ../hopper in this repository; this directory holds the torch op registration, the Python wrapper, the tests and the wheel build script. The build image, the wheel retag script and the release index script live in sgl-project/sglang, next to those of the other SGLang-built wheels.

What is built

  • Forward only (FLASHATTENTION_DISABLE_BACKWARD); sparse mask kernels off by default.

  • Only the variants SGLang reaches, so the wheel stays under PyPI's file size limit:

    • no append-KV / rotary path (FLASHATTENTION_DISABLE_APPENDKV): SGLang writes the KV cache itself;
    • split, non-TMA paged and softcap kernels for varlen only (FLASHATTENTION_VARLEN_ONLY_SPLIT_PAGED_SOFTCAP); a dense call that needs one is run as varlen with a full-length seqused_k, which gives the same result;
    • no Q/K 64 with V 256 (FLASHATTENTION_DISABLE_HDIMDIFF64_256); absorbed MLA uses V 512.

    Calls that need a compiled-out variant raise instead of running something else.

  • sm_90a, plus sm_80/sm_86 (A100, A10, L40, 4090). No SM100+ targets.

  • BF16, FP16 and FP8 (E4M3).

  • x86_64 Linux, CUDA 13.0 (+cu130), one abi3 wheel for CPython 3.10+.

  • Pinned to torch==2.14.1: the extension uses the regular torch C++ ABI, so a release only loads against the torch it was built with.

Usage

from sgl_fa3 import flash_attn_varlen_func, flash_attn_with_kvcache, get_scheduler_metadata

The ops are registered as torch.ops.sgl_fa3.fwd and torch.ops.sgl_fa3.get_scheduler_metadata.

Building

sgl_fa3/scripts/build.sh 3.10 13.0 /path/to/sglang

builds in a pytorch/manylinux2_28-builder:cuda13.0 container (image from sglang's docker/sgl-fa3.Dockerfile, retagged with sglang's scripts/rename_sgl_fa3_whl.sh) and writes sgl_fa3/dist/ (+cu130 wheel for the sgl-whl index) and sgl_fa3/dist-pypi/ (same wheel without the local version, for PyPI). The build reads ../hopper, so it needs a full checkout; an sdist is not supported.

For a local build against an installed torch:

cd sgl_fa3 && pip install . --no-build-isolation -v

Releasing

Releases are cut by the Release sgl-fa3 workflow in sgl-project/sglang (.github/workflows/release-whl-fa3.yml). It checks out this branch, writes the version into python/sgl_fa3/_version.py, runs scripts/build.sh, tests the wheel on H200 with tests/, then publishes to PyPI and the sgl-project/whl index (sglang's scripts/update_fa3_whl_index.py).

Metadata

Release files for sgl-fa3 0.1.0rc0

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

Built distribution (wheel)

Table of built distributions (wheels) for sgl-fa3 0.1.0rc0
File Interpreter ABI Platform Actions
sgl_fa3-0.1.0rc0-cp310-abi3-manylinux2014_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for sgl_fa3-0.1.0rc0-cp310-abi3-manylinux2014_x86_64.whl

Release files / sgl_fa3-0.1.0rc0-cp310-abi3-manylinux2014_x86_64.whl

Download URL sgl_fa3-0.1.0rc0-cp310-abi3-manylinux2014_x86_64.whl
Size 57.4 MB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
c68ed4845d5d77f288e49731ffc14da644602b7c88abd7f7c3f29a395952feaa
BLAKE2b-256 checksum
How to use checksums
47b23cd8bbb042345250cdf5be12a9c89cfcd3ce0ed0e3a198682558d6780239
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for sgl-fa3 0.1.0rc0

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.

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