[Intel XPU]support xgrammar backend for intel xpu (#13245)

This commit is contained in:
gaopengff
2025-11-24 16:48:00 +08:00
committed by GitHub
parent 04b52fa8d6
commit aeac622058

View File

@@ -104,7 +104,11 @@ class XGrammarGrammar(BaseGrammarObject):
return vocab_mask.to(device, non_blocking=True)
def apply_vocab_mask(self, logits: torch.Tensor, vocab_mask: torch.Tensor) -> None:
if logits.device.type == "cuda" or logits.device.type == "npu":
if (
logits.device.type == "cuda"
or logits.device.type == "npu"
or logits.device.type == "xpu"
):
if _is_hip:
apply_token_bitmask_inplace_cuda(logits, vocab_mask)
else: