Skip to content

Conversation

@danieldk
Copy link
Member

@danieldk danieldk commented Nov 8, 2025

Prior to this change, kernels were stored in build/<variant>/<extname>. However, this was fragile because the extension name had to correspond to the repository name. This change flattens kernels to be stored inside build/<variant>.

For compatibility with older versions of kernels, we add a module build/<variant>/<extname> that loads build/<variant>, this compatibility module will removed when the kernels update has been around for a while.

@danieldk danieldk force-pushed the flatten-build-variant branch from 6d82366 to 029516f Compare November 10, 2025 14:06
danieldk added a commit to huggingface/kernels that referenced this pull request Nov 10, 2025
Support kernels that have the main module at `build/<variant>`.
See: huggingface/kernel-builder#293
danieldk added a commit to huggingface/kernels that referenced this pull request Nov 10, 2025
Support kernels that have the main module at `build/<variant>`.
See: huggingface/kernel-builder#293
danieldk added a commit to huggingface/kernels that referenced this pull request Nov 11, 2025
Support kernels that have the main module at `build/<variant>`.
See: huggingface/kernel-builder#293
@danieldk danieldk force-pushed the flatten-build-variant branch from 79e121a to 73c93e0 Compare November 11, 2025 10:05
@danieldk danieldk marked this pull request as ready for review November 11, 2025 10:22
Prior to this change, kernels were stored in `build/<variant>/<extname>`.
However, this was fragile because the extension name had to correspond to
the repository name. This change flattens kernels to be stored inside
`build/<variant>`.

For compatibility with older versions of kernels, we add a module
`build/<variant>/<extname>` that loads `build/<variant>`, this
compatibility module will removed when the `kernels` update has been
around for a while.
- Validate that the kernel does not have a file/directory
  `torch-ext/<mod_name>/<mod_name>` since we need that directory for the
  compat module.
- Validate that the kernel has `torch-ext/<mod_name>/__init__.py`. This
  is also verified by get-kernel-check, but that only fires *after* the
  kernel is already compiled.
@danieldk danieldk force-pushed the flatten-build-variant branch from e32daf4 to 25cddd9 Compare November 11, 2025 10:25
danieldk added a commit to huggingface/kernels that referenced this pull request Nov 11, 2025
Support kernels that have the main module at `build/<variant>`.
See: huggingface/kernel-builder#293
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.

Thanks for fixing this

@danieldk danieldk merged commit 76b691d into main Nov 11, 2025
28 checks passed
@danieldk danieldk deleted the flatten-build-variant branch November 11, 2025 13:43
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.

3 participants