Skip to content

sgl-flash-attn3: build against the Torch stable ABI #1043

Description

@moon-bot-app

sgl-flash-attn3 is currently built against a specific Torch version ([torch] src = [...torch-ext/torch_binding.cpp...], no stable-abi). SGLang has moved to Torch 2.11, which we are deprecating in the kernel builder (see huggingface/kernels#732, this discussion). Rather than keeping a legacy Torch version alive just for this kernel, it would be better to switch it to the Torch stable ABI, like we already do for flash-attn3 and vllm-flash-attn3 — then a single build works across Torch versions.

The upstream kernel already has everything needed: it is in sync with the upstream stable ABI sources, cf. hopper/flash_api_stable.cpp.

So this should mostly be build configuration changes, mirroring flash-attn3:

  • In sgl-flash-attn3/build.toml, set stable-abi in the [torch] section and point src at flash_api_stable.cpp instead of the torch-ext/ bindings + shim.
  • Adjust sgl-flash-attn3/flake.nix if needed (cf. flash-attn3/flake.nix).
  • Verify that the op signatures exposed by flash_api_stable.cpp stay in sync with flash_api.cpp modulo stable API/ABI differences, so the Python-side API does not change for SGLang users.

cc @danieldk @sayakpaul


Requested by Daniël de Kok - Slack thread - Agent trace

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions