Skip to content

get_kernel: support specifying the backend#268

Merged
danieldk merged 8 commits into
mainfrom
get-kernel-backend
Feb 11, 2026
Merged

get_kernel: support specifying the backend#268
danieldk merged 8 commits into
mainfrom
get-kernel-backend

Conversation

@danieldk
Copy link
Copy Markdown
Member

@danieldk danieldk commented Feb 6, 2026

So far, get_kernel has always auto-detected the backend from the Torch build. However, this causes issues in fixed-device settings where we may want to run some ops on the CPU and others on the GPU. This change allows specifying backend as an argument to get_kernel and friends.

Currently, only the cpu backend and the backend that Torch was built for are supported (since we cannot determine the version, etc. of a backend that Torch was not built for). However, we decided to make it a string-based argument as opposed to e.g. a cpu bool, in the case Torch might do multi-backend builds in the future.

So far, `get_kernel` has always auto-detected the backend from the Torch
build. However, this causes issues in fixed-device settings where we may
want to run some ops on the CPU and others on the GPU. This change
allows specifying `backend` as an argument to `get_kernel` and friends.

Currently, only the `cpu` backend and the backend that Torch was built
for are supported (since we cannot determine the version, etc. of a
backend that Torch was not built for). However, we decided to make it a
string-based argument as opposed to e.g. a `cpu` bool, in the case Torch
might do multi-backend builds in the future.
@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.

MekkCyber
MekkCyber previously approved these changes Feb 11, 2026
Copy link
Copy Markdown
Contributor

@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.

Looks good! just a nit

Comment thread kernels/src/kernels/utils.py Outdated
@danieldk danieldk merged commit f00aae9 into main Feb 11, 2026
38 checks passed
@danieldk danieldk deleted the get-kernel-backend branch February 11, 2026 13:57
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