Skip to content

Conversation

@danieldk
Copy link
Member

@danieldk danieldk commented Dec 3, 2025

This change adds support for noarch build variants. So far we have used the universal variant for kernels that do not have any AoT-compiled code. However, the universal variant has two important issues:

  1. A kernel without AoT-compiled might still be backend-specific. E.g. NVIDIA CuTe-based kernels are not universal in the sense that they don't work on non-NVIDIA GPUs.
  2. We cannot specify dependencies per backend.

To solve these issues, we introduce the noarch variants to replace universal kernels. Noarch kernels have variants of the shape torch-<backend> (e.g. torch-xpu). This resolves the issues outlined.

This change introduces support for loading noarch kernels. In the future, we will start emitting deprecation warnings for universal kernels (to eventually remove support).


This change also fixes some small issues with CPU kernels that surfaced while making a test for noarch.

This change adds support for noarch build variants. So far we have used
the universal variant for kernels that do not have any AoT-compiled code.
However, the universal variant has two important issues:

1. A kernel without AoT-compiled might still be backend-specific. E.g.
  NVIDIA CuTe-based kernels are not universal in the sense that they
  don't work on non-NVIDIA GPUs.
2. We cannot specify dependencies per backend.

To solve these issues, we introduce the noarch variants to replace
universal kernels. Noarch kernels have variants of the shape
`torch-<backend>` (e.g. `torch-xpu`). This resolves the issues outlined.

This change introduces support for loading noarch kernels. In the
future, we will start emitting deprecation warnings for universal
kernels (to eventually remove support).
@HuggingFaceDocBuilderDev

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 danieldk marked this pull request as ready for review December 3, 2025 12:58
MekkCyber
MekkCyber previously approved these changes Dec 3, 2025
Copy link
Collaborator

@MekkCyber MekkCyber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you

Comment on lines +211 to +212
assert variant_path is not None

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not really needed but okay to keep it

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is necessary to communicate to the type checker that at that point variant_path cannot be None anymore (mypy will fail without the assert).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah okay makes sense 👍

@danieldk danieldk merged commit d9f60ff into main Dec 3, 2025
13 checks passed
@danieldk danieldk deleted the noarch-build-variants branch December 3, 2025 14:07
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.

4 participants