Repository navigation
Add Strix Halo (gfx1151) Atlas Inference Hub-kernel path for Qwen3.5/3.6/3.8 Gated DeltaNet - #49127
Conversation
vasqu
left a comment
There was a problem hiding this comment.
Yep thanks, same as in the GB10 case. Would just like to combine the comments to just mention kernels in general and note your special kernels with their benchmarks
| | `False` (PyTorch fallback) | 1.33 s | 5.77 tok/s | | ||
| | `True` ([`Atlas-Inference/gdn`](https://huggingface.co/kernels/Atlas-Inference/gdn)) | 1.16 s (1.15x faster) | 6.23 tok/s | | ||
|
|
||
| Most of this prefill is the dense projection GEMMs, which the kernel does not touch; per Gated DeltaNet layer of `Qwen/Qwen3.8-27B` the kernel is 1.65x faster on a 1024-token prefill and 1.26x faster per decode step. The published build targets torch 2.14 with ROCm 7.2. |
There was a problem hiding this comment.
Imo we can combine both into mentioning the specialized kernels wdyt?
There was a problem hiding this comment.
I.e. we can shorten the comments a bit and nudge users to use your kernels on the specialized hw
There was a problem hiding this comment.
Sure I can work on this @vasqu! Will have an update for you in a moment. Ideally pass CI too then 😅
|
Thanks @AzeezIsh |
Co-authored-by: Anton Vlasjuk <73884904+vasqu@users.noreply.github.com>
|
Thanks for taking a look @vasqu, @Abdennacer-Badaoui! As I mentioned above, would appreciate if it was possible to add Atlas Inference to the kernels trusted-publisher allowlist. I could then continue making future contributions that automatically slot in rather than the additional If there's an additional process for this, more than happy to take it on 🫡 |
stevhliu
left a comment
There was a problem hiding this comment.
thanks for the docs! just one question and some small nits :)
if i understand correctly, it seems like the kernel is selected based on a capability number thats shared by several AMD GPUs and not just Strix Halo. this may be worth clarifying
|
|
||
| - Layers are hybrid: [`Qwen3_5TextConfig`]'s `layer_types` is a per-layer list of `"linear_attention"` or `"full_attention"` that encodes the 3:1 Gated DeltaNet / Gated Attention stack. The DeltaNet path (`Qwen3NextGatedDeltaNet`) needs the optional `causal_conv1d` (from [Dao-AILab](https://github.com/Dao-AILab/causal-conv1d)) and `fla` packages for its fast kernels — without them, the model silently falls back to slower and more memory hungry PyTorch ops. | ||
| - On NVIDIA GB10 (compute capability 12.1 / SM121) neither `causal_conv1d` nor `fla` ship an SM121 build, so the DeltaNet path always falls back to the slow PyTorch reference. Passing `use_kernels=True` (`pip install -U kernels`) to [`~PreTrainedModel.from_pretrained`] swaps the Gated DeltaNet conv1d and delta-rule cores for a compute-capability-gated Hub kernel ([`Atlas-Inference/gdn`](https://huggingface.co/kernels/Atlas-Inference/gdn)); every other GPU keeps the existing path. The kernel is numerically faithful to the fallback (identical greedy output) and speeds up prefill. Measured on `Qwen/Qwen3.6-27B` (bf16, GB10/SM121, 1024-token prompt, greedy decode of 256 tokens): | ||
| - On NVIDIA GB10 (`SM121`) and AMD Strix Halo (`gfx1151`), `causal_conv1d` and `fla` have no build, so the DeltaNet path falls back to the slow PyTorch reference. Pass `use_kernels=True` (`pip install -U kernels`) to [`~PreTrainedModel.from_pretrained`] to use the specialized [`Atlas-Inference/gdn`](https://huggingface.co/kernels/Atlas-Inference/gdn) kernels instead. They are gated to these two GPUs (every other GPU keeps the existing path), produce identical greedy output, and currently load with `trust_remote_code=True` until `Atlas-Inference` is added to the trusted-kernels allowlist. The Strix Halo build targets torch 2.14 with ROCm 7.2. Measured in bf16 with a 1024-token prompt and greedy decode of 256 tokens: |
There was a problem hiding this comment.
| - On NVIDIA GB10 (`SM121`) and AMD Strix Halo (`gfx1151`), `causal_conv1d` and `fla` have no build, so the DeltaNet path falls back to the slow PyTorch reference. Pass `use_kernels=True` (`pip install -U kernels`) to [`~PreTrainedModel.from_pretrained`] to use the specialized [`Atlas-Inference/gdn`](https://huggingface.co/kernels/Atlas-Inference/gdn) kernels instead. They are gated to these two GPUs (every other GPU keeps the existing path), produce identical greedy output, and currently load with `trust_remote_code=True` until `Atlas-Inference` is added to the trusted-kernels allowlist. The Strix Halo build targets torch 2.14 with ROCm 7.2. Measured in bf16 with a 1024-token prompt and greedy decode of 256 tokens: | |
| - `causal_conv1d` and `fla` don't provide a build for NVIDIA GB10 (`SM121`) and AMD Strix Halo (`gfx1151`), so the DeltaNet path falls back to the slow PyTorch reference. Pass `use_kernels=True` (`pip install -U kernels`) to [`~PreTrainedModel.from_pretrained`] to use the specialized [Atlas-Inference/gdn](https://huggingface.co/kernels/Atlas-Inference/gdn) kernels instead. They are gated to these two GPUs (every other GPU keeps the existing path), and produce identical greedy output. The mapping currently enables `trust_remote_code=True` for this kernel because `Atlas-Inference` is not yet on the trusted-kernels allowlist. The Strix Halo build targets torch 2.14 with ROCm 7.2. Benchmarks used bf16 with a 1024-token prompt, and greedy decoding for 256 tokens. |
There was a problem hiding this comment.
Thanks @stevhliu. Well this rocm entry matches on torch.cuda.get_device_capability(), and every RDNA 3.5 part does report (11, 5) including gfx1150 (Strix Point), gfx1151(Strix Halo) and gfx1152 (Krackan Point). Given ROCMProperties takes a capability range, the mapping itself can't narrow down to gfx1151. So what does keep others off this particular kernel is the arch check with the published build declaring gfx1151, so on gfx1150/gfx1152 use_kernels=True fails at load with an "arch not supported by the build". I've pushed it up to clarify!
CI recapDashboard: View test results in Grafana |
|
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. |
|
@AzeezIsh thanks for your continued support. The number of seats we want to allocate for "Trusted Publishers" is really really limited and is quite reserved at the moment. This is why allowing repo ids through |
Done! CC'ed you as well @sayakpaul |
On AMD Strix Halo (Ryzen AI Max,
gfx1151, RDNA 3.5) theflaandcausal_conv1dfast paths have no ROCm build, so Qwen3.5-family models (Qwen3.5, Qwen3.6-27B, Qwen3.8-27B) fall back to the slow pure-torch Gated DeltaNet (is_fast_path_available=False). This adds arocmdevice entry, gated to that GPU, to the existingQwen3_5GatedDeltaNetmapping from #46423, pointing at the ROCm build of the same Hub kernel (Atlas-Inference/gdn). Strix Halo users get the fast path automatically; every other GPU, including other ROCm GPUs, keeps its existing path.Device(type="rocm", properties=ROCMProperties(min_capability=115, max_capability=115))entry next to the GB10 one inintegrations/hub_kernels.py, same layer name and repo, revision pinned.docs/source/en/model_doc/qwen3_5.md.The kernel is the same stateless
kernelslayer as the GB10 build. it reuses the host module's projections, gated RMSNorm andout_proj, and replaces only the conv1d, q/k L2-norm and delta-rule cores. On gfx1151 it runs the kernels the Atlas engine serves Qwen3.6/3.8-27B with on Strix Halo.causal_conv1d_update_prefill→l2_norm_bf16→ FLA-chunked delta rule (recompute_wu→chunk_delta_h→chunk_fwd_o)causal_conv1d_update_l2norm_f32→gated_delta_rule_decode_f32What does this PR do?
The gated
rocmentry inintegrations/hub_kernels.pyplus the docs note.@use_kernel_forward_from_hub("Qwen3_5GatedDeltaNet")decorators from #46423 already cover the dense and MoE classes.Verified on Strix Halo (gfx1151,
torch.cuda.get_device_capability() == (11, 5)), bf16, torch 2.14.0 ROCm 7.2 and ROCm 7.14 wheels, transformersmain+kernels0.17:kernelize()swaps the forward of all 24/24 GDN layers ofQwen/Qwen3.5-9B, and the profiler shows the kernel ops running.main+ this PR,from_pretrained(..., use_kernels=True)with an empty kernel cache pullsAtlas-Inference/gdnat the pinned revision. All 24/24 GDN layers ofQwen/Qwen3.5-9Brun it, and greedygenerate()produces identical token IDsMeasured through the end-user path (
from_pretrained(..., use_kernels=True), kernel pulled from the Hub) onQwen/Qwen3.5-9B(bf16, gfx1151, torch 2.14 + ROCm 7.2, 1024-token prompt, greedy decode of 256 tokens; mean of two runs):use_kernelsFalse(PyTorch fallback)True(Atlas-Inference/gdn)About 74% of this prefill is the dense projection GEMMs, which the kernel doesn't touch. Per Gated DeltaNet layer of
Qwen/Qwen3.8-27B(real weights), the kernel is 1.65x faster on a 1024-token prefill and 1.26x faster per decode step. The published build targets torch 2.14 with ROCm 7.2.Follow-up to #46423 (the GB10/SM121 entry). The ROCm build needs kernel-builder with gfx1151 support, which landed in huggingface/kernels#839 (tracked in huggingface/kernels#834). No overlapping PR exists.
The same trust note applies as for the GB10 entry: the mapped kernel needs
trust_remote_code=TrueuntilAtlas-Inferenceis on thekernelstrusted-publisher allowlist, would love to enable this for continued future contributions without any blocks!Code Agent Policy
Before submitting
Who can review?
@vasqu original PR merger, @danieldk first issue
Potentially @drbh (kernels integration) and @Cyrilvallez (text models / Qwen3.5) as well :)
If you could enable myself on the
kernelstrusted-publisher allowlist that would help for the future!