[Feat][XPU] VLLM_BATCH_INVARIANT support for Dense/MoE models (#55881)

Signed-off-by: Tony Lin <tony.lin@intel.com>
Co-authored-by: Flora Feng <4florafeng@gmail.com>
This commit is contained in:
Tony Lin
2026-09-22 11:06:54 -04:00
committed by GitHub
co-authored by Flora Feng
parent 1ea7c63f4a
commit e4340e41c9
10 changed files with 619 additions and 8 deletions
+6 -1
View File
@@ -224,9 +224,14 @@ class TopKTopPSampler(nn.Module):
else:
self.forward = self.forward_cpu
elif current_platform.is_xpu():
if xpu_sampler_supported():
if xpu_sampler_supported() and not envs.VLLM_BATCH_INVARIANT:
self.forward = self.forward_xpu
else:
if envs.VLLM_BATCH_INVARIANT:
logger.info_once(
"VLLM_BATCH_INVARIANT is enabled. Using the "
"PyTorch-native sampler on XPU."
)
self.forward = self.forward_native
elif (
logprobs_mode not in PROCESSED_LOGPROBS_MODES