Skip to content

triton-kernels: publish an XPU build variant - #1136

Merged
github-actions[bot] merged 2 commits into
huggingface:mainfrom
jiqing-feng:triton-kernels-xpu
Sep 4, 2026
Merged

triton-kernels: publish an XPU build variant#1136
github-actions[bot] merged 2 commits into
huggingface:mainfrom
jiqing-feng:triton-kernels-xpu

Conversation

@jiqing-feng

Copy link
Copy Markdown
Contributor

Follow-up to #1075. The Intel fixes landed there, but they are still unreachable through kernels.

triton-kernels is [torch-noarch], yet backends decides which variant directories get published, and it lists only cuda. So the repo ships build/torch-cuda only and get_kernel fails on an Intel GPU:

FileNotFoundError: Cannot find a build variant for this system in kernels-community/triton-kernels
  torch-cuda: backend (cuda) does not match system backend (xpu) and is not universal

Adding xpu costs no compilation — being noarch, the variant has the same file set as torch-cuda. liger-kernels already publishes torch-cuda, torch-rocm and torch-xpu this way. rocm is left out here only because I cannot validate it.

The second commit lets the tests honour the existing --device fixture instead of hardcoding device="cuda" / torch.cuda.*; compute-capability checks move behind is_cuda(), and genuinely CUDA-only tests are untouched.

Validation

Intel Arc Pro B60, --device xpu: 14 passed / 2 skipped for the kernels_ci subset, 131 passed / 9 skipped across the edited modules. --device cuda is unchanged, and the CUDA-only CI runner gains no new job.

The kernel is `[torch-noarch]`, but `backends` still decides which variant
directories are published to the Hub, and it lists only `cuda`. On an Intel
GPU `get_kernel` therefore fails outright:

    FileNotFoundError: Cannot find a build variant for this system in
    kernels-community/triton-kernels
      torch-cuda: backend (cuda) does not match system backend (xpu)
                  and is not universal

which now also stops the test suite from being collected at all, since the
tests moved to `get_kernel`. The Intel opt-flag heuristics added in huggingface#1075 are
consequently unreachable through `kernels`.

Being noarch, this adds no compilation: the extra variant has the same file
set as `torch-cuda`, the same way `liger-kernels` publishes torch-cuda,
torch-rocm and torch-xpu from identical sources.
Several tests hardcoded `device="cuda"` or called `torch.cuda.*` unconditionally,
so on a non-CUDA build they failed with "Torch not compiled with CUDA enabled"
rather than exercising the kernel. Take the existing `device` fixture instead,
and guard the capability-based skips behind `target_info.is_cuda()` so they stay
skips on CUDA and are simply not consulted elsewhere.

`test_routing.init_data` loses its `device` default for the same reason; both
call sites (test_routing, test_swiglu) already have the fixture at hand.

The `kernels_ci` subset and the full test_mxfp / test_routing / test_swiglu /
test_tensor_details modules pass on Intel Arc Pro B60 (131 passed, 9 skipped).
No behaviour changes on CUDA, where the fixture already defaults to "cuda".
@jiqing-feng
jiqing-feng marked this pull request as ready for review September 4, 2026 02:30
@github-actions github-actions Bot added the chore Version bumps, releases, misc maintenance label Sep 4, 2026
@danieldk

danieldk commented Sep 4, 2026

Copy link
Copy Markdown
Member

/kernel-bot build triton-kernels

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Build request processed.

Command: /kernel-bot build triton-kernels
Mode: build only
Target branch: pr-1136
PR head SHA: 018222a8ddd48557a0dbc75399d23466f99ca692
Workflows: build.yaml, build-mac.yaml, build-windows.yaml

Dispatched (1):

@danieldk

danieldk commented Sep 4, 2026

Copy link
Copy Markdown
Member

/kernel-bot merge-and-upload triton-kernels

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

Build request processed.

Command: /kernel-bot merge-and-upload triton-kernels
Mode: merge, build and upload
Target branch: ``
PR head SHA: 018222a8ddd48557a0dbc75399d23466f99ca692
Workflows: `build.yaml, build-mac.yaml, build-windows.yaml`

Merge result: Pull Request successfully merged

Dispatched (1):

Hub uploads:

@github-actions
github-actions Bot merged commit 5a4ff7d into huggingface:main Sep 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Version bumps, releases, misc maintenance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants