Skip to content

Support the Torch stable ABI#575

Draft
danieldk wants to merge 5 commits into
mainfrom
torch-stable-abi
Draft

Support the Torch stable ABI#575
danieldk wants to merge 5 commits into
mainfrom
torch-stable-abi

Conversation

@danieldk
Copy link
Copy Markdown
Member

@danieldk danieldk commented May 21, 2026

This change adds an option stable-abi to build.toml. When setting

[torch]                                                                                                                                                                                                                           
stable-abi = "2.11"                                                                                                                                                                                                               

The extension will be built targeting the Torch 2.11 stable ABI. In this case, the variant naming pattern will also change from torch<version> to torch-stable-abi<abi-version>.

This PR also adds support for this new type of variant to kernels and the Nix builder. In the case of the Nix builder, we always use the latest Torch version available for a backend + backend version combination to build the ABI-stable kernel.

This change also removes the auto-update while reading from the v3 to v4 build.toml format. The auto-conversion can give very weird errors when there is an issue with the file. For instance, when the stable-abi option is malformed, the error message will claim that there is no torch section. The update-build subcommand is still available.

@HuggingFaceDocBuilderDev
Copy link
Copy Markdown

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

danieldk added 5 commits May 22, 2026 13:37
This change adds an option `stable-abi` to `build.toml`. When setting

```toml
[torch]
stable-abi = "2.11"
```

The extension will be built targeting the Torch 2.11 stable ABI. In
this case, the variant naming pattern will also change from
`torch<version>` to `torch-stable-abi<abi-version>`.
Wire up the `torch-stable-abi` variant naming. For a given ABI version,
we build with the newest Torch version.
This change adds support for `torch-stable-abi` variants:

* We now give preference to stable ABI variants.
* If there is no exact match for the Torch version, we back off to an
  older ABI version.
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.

2 participants