Skip to content

[docs] AITER kernels - #46871

Merged
stevhliu merged 3 commits into
huggingface:mainfrom
stevhliu:aiter-kernel
Jun 25, 2026
Merged

stevhliu merged 3 commits into
huggingface:mainfrom
stevhliu:aiter-kernel

Conversation

@stevhliu

Copy link
Copy Markdown
Member

add docs for #46268

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

@vasqu vasqu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A bit unsure because I expect more versatility per device type in the future

Would wait a bit on @Abdennacer-Badaoui first on his thoughts

model = AutoModelForCausalLM.from_pretrained(
"Qwen/Qwen3-0.6B",
use_kernels=True,
device_map="cuda"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Imo maybe we should change this instead and have a small comment that for each platform a different set of default kernels are applied

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm thinking of a table with columns for NVIDIA / ROCm / XPU, and for each operation the name of the hub kernel used. We can update it whenever we change the defaults.


## AMD GPUs

AMD GPUs report their device type as `cuda` in PyTorch. Transformers detects ROCm at runtime and routes supported operations to [AITER](https://github.com/ROCm/aiter) Triton kernels built for AMD hardware. You don't need to set the device type yourself.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I expect more than just aiter kernels in the future? so unsure if we need a whole section if we should a more general section / comment on different kernels for each device type

but would let @Abdennacer-Badaoui decide on the approach

@Abdennacer-Badaoui Abdennacer-Badaoui Jun 24, 2026 •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Exactly. We started with aiter kernels as a PoC for the amd team, to encourage them to start adding kernels to the hub. We'd swap the defaults anytime we come up with a more performant triton/hip kernel, not necessarily from aiter. So it'd be nice to frame it as: use_kernels=True loads the most performant triton/hip kernels available on the Hub to replace key operations in your model for amd. And we can still link aiter as an example of those kernels atm.

@vasqu vasqu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good 🫡 thanks!

@github-actions

Copy link
Copy Markdown
Contributor

CI Dashboard: View test results in Grafana

@stevhliu
stevhliu added this pull request to the merge queue Jun 25, 2026
Merged via the queue into huggingface:main with commit db7c372 Jun 25, 2026
26 checks passed
@stevhliu
stevhliu deleted the aiter-kernel branch June 25, 2026 17:37
stevhliu added a commit to stevhliu/transformers that referenced this pull request Jul 30, 2026
* docs

* feedback

* table
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