[XPU] Enable ring attention on XPUAttentionBackend (#41406)

Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chetan Kumar Verma
2026-10-09 10:41:11 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent df1e4f3f2b
commit fedab5537b
@@ -26,6 +26,10 @@ from sglang.multimodal_gen.runtime.layers.attention.backends.flash_attn import (
class XPUAttentionBackend(AttentionBackend):
@classmethod
def supports_ring_rotation(cls) -> bool:
return True
accept_output_buffer: bool = True
@staticmethod
@@ -115,6 +119,8 @@ class XPUAttentionImpl(AttentionImpl):
if return_softmax_lse:
out_tensor, softmax_lse = out[:2]
result = out_tensor.reshape(bsz, seqlen_q, nheads_q, d)
# The kernel returns lse as (H, B * S); ring attention needs [B, H, S].
softmax_lse = softmax_lse.view(nheads_q, bsz, seqlen_q).permute(1, 0, 2)
return result, softmax_lse
result = out.reshape(bsz, seqlen_q, nheads_q, d)