kernels benchmark does not support XPU

Open
#669 2 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@drbh is already working on this.

Since Jul 1, 2026.

  • #727 by @AdityaKulshrestha — open

Assessment

This issue has not been assessed yet.

Description

bug
Description

Expected the XPU to be discovered and used for benchmarking for kernels that have XPU versions.

Steps to reproduce
# Will open PR to add kernels[xpu] soon
uv pip install --index  https://download.pytorch.org/whl/xpu "torch==2.12+xpu"

uv pip install "kernels[benchmark]"

source .venv/bin/activate

kernels benchmark kernels-community/flash-attn2 --version 1
Traceback (most recent call last):
  File "/dan/projects/kernels/.venv/bin/kernels", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/dan/projects/kernels/.venv/lib/python3.12/site-packages/kernels/cli/__init__.py", line 87, in main
    args.func(args)
  File "/dan/projects/kernels/.venv/lib/python3.12/site-packages/kernels/cli/__init__.py", line 165, in run_benchmark
    benchmark.run_benchmark(
  File "/dan/projects/kernels/.venv/lib/python3.12/site-packages/kernels/cli/benchmark.py", line 751, in run_benchmark
    results, kernel_sha = run_benchmark_script(
                          ^^^^^^^^^^^^^^^^^^^^^
  File "/dan/projects/kernels/.venv/lib/python3.12/site-packages/kernels/cli/benchmark.py", line 650, in run_benchmark_script
    results, kernel_sha = run_benchmark_class(
                          ^^^^^^^^^^^^^^^^^^^^
  File "/dan/projects/kernels/.venv/lib/python3.12/site-packages/kernels/cli/benchmark.py", line 501, in run_benchmark_class
    setup_fn()
  File "/dan/projects/kernels/.venv/lib/python3.12/site-packages/kernels/benchmarks/attention.py", line 75, in setup_large
    self.q = torch.randn(B, S, H, D, device="cuda", dtype=torch.float16)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/dan/projects/kernels/.venv/lib/python3.12/site-packages/torch/cuda/__init__.py", line 484, in _lazy_init
    raise AssertionError("Torch not compiled with CUDA enabled")
Expected behavior

Measure performance.

Environment
  • kernels 0.15.2
  • python 3.12.13
  • torch 2.12.0+xpu
  • triton-xpu 3.7.1
  • Linux
Additional context

No response

Dominant language
Python
Stars
781
Forks
141
Avg merge
1d 10h
Merged PRs (30d)
57

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from huggingface/kernels

All issues in huggingface/kernels

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.