Skip to content

Package as sgl-flash-mla for release - #19

Merged
DarkSharpness merged 2 commits into
sglfrom
release-wheels
Oct 20, 2026
Merged

DarkSharpness merged 2 commits into
sglfrom
release-wheels

Conversation

@DarkSharpness

Copy link
Copy Markdown
Collaborator

Prepares this fork to ship as its own wheel. Build infrastructure lives in the sglang repo; this is the packaging side.

What changes

  • Distribution name sgl-flash-mla. The import name stays flash_mla, so downstream code reads the same whichever wheel it came from. Mirrors sgl-deep-gemm, which installs under that name and imports as deep_gemm.
  • Version comes from flash_mla/VERSION, which the release workflow overwrites and which ships inside the wheel, so flash_mla.__version__ and the wheel metadata cannot drift. get_version() used to append +<git rev>: PyPI rejects local version segments, and the wheel index spells the CUDA build as +cuNNN itself, so the two would have collided.
  • PyPI metadata: description, long description from the README, MIT license, classifiers, python_requires>=3.10.
  • torch==2.14.1, the version SGLang builds against.

On the torch pin

The extensions are built against PyTorch's stable C++ ABI, so the binary is more permissive than the pin. Measured on the built wheel:

undefined CPython (Py*/_Py*) symbols:                0
undefined torch C++ mangled (_ZN3c10/_ZN2at/...):    0
undefined torch stable C shim (aoti_torch_*):       68

Zero CPython symbols, because neither extension defines PyInit_* -- both register through STABLE_TORCH_LIBRARY during static initialisation and are loaded with torch.ops.load_library. Zero C++ mangled symbols, so nothing depends on libtorch's unstable ABI.

Installing the wheel into a clean venv with torch 2.10.0+cu128 loads both extensions and resolves both op namespaces, so torch>=2.10 would work. The pin says 2.14.1 anyway because that is the version a release is tested against. One caveat if it is ever relaxed: the extensions link libcudart.so.13, which a cu128 torch does not bundle, so a CUDA 13 runtime has to come from somewhere.

Verification

The wheel builds and retags end to end:

setup.py bdist_wheel  ->  sgl_flash_mla-1.0.0-cp310-abi3-linux_x86_64.whl   (7.9 MB)
retag                 ->  sgl_flash_mla-1.0.0+cu130-cp310-abi3-manylinux2014_x86_64.whl

packaging.parse_wheel_filename reads it back as name=sgl-flash-mla, version=1.0.0+cu130, tag=cp310-abi3-manylinux2014_x86_64.

🤖 Generated with Claude Code

DarkSharpness and others added 2 commits October 20, 2026 06:47
Distribution name sgl-flash-mla; the import name stays flash_mla, so downstream
code reads the same whichever wheel it came from. Mirrors sgl-deep-gemm, which
installs as sgl-deep-gemm and imports as deep_gemm.

The version comes from flash_mla/VERSION, which the release workflow
overwrites, and which ships in the wheel so __version__ reads the same string
the metadata does. get_version() used to append +<git rev>: PyPI rejects local
version segments, and the wheel index spells the CUDA build as +cuNNN itself,
so the two would have collided.

torch is pinned to 2.14.1, the version SGLang builds against. The extensions use
PyTorch's stable C++ ABI and would load against any 2.10+, but a release is
tested against one version, so that is the one it asks for.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SGLang and sgl-kernel pin torch==2.14.1 because their extensions link
libtorch's C++ ABI, which moves between releases. These do not: the built
wheel holds 68 undefined symbols from the stable C shim (aoti_torch_*) and
zero mangled C++ ones, which is what TORCH_TARGET_VERSION buys. An == pin
would be paying for the stable ABI and not using it.

>= cannot conflict with SGLang's ==: installed together, pip resolves to
2.14.1 either way. It only stops the wheel from pinning anyone who uses it
without SGLang.

The floor stays 2.14.1, not the 2.10 that TORCH_TARGET_VERSION would allow.
A 2.10 wheel is cu128 and does not bundle the libcudart.so.13 these
extensions link, so it works only where a CUDA 13 runtime comes from
somewhere else -- a condition pip has no way to express -- and 2.14.1 is
what CI tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant