A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 3, 20:15 UTC
[XPU] keep generator state of sycl kernel align with pytorch (#41771)
Signed-off-by: Yan Ma <yan.ma@intel.com> Co-authored-by: Qiming Zhang <qiming1.zhang@intel.com> Co-authored-by: Kunshang Ji <kunshang.ji@intel.com>
Yan Ma committed
May 12, 2026 at 19:44 UTC
bc03f280c8e65ae5832ef14fb97f1a2bc19c0c35
1 file changed
+5
vllm/v1/sample/ops/topk_topp_sampler.py
+5
@@ -289,6 +289,11 @@ class TopKTopPSampler(nn.Module):
289
torch.ops.vllm.xpu_topk_topp_sampler(
290
random_sampled, logits_to_return, logits, k, p, self.logprobs_mode, seeds
291
)
292
+ # The custom XPU sampler kernel consumes RNG values internally, so advance
293
+ # the default generator's offset to keep future draws deterministic.
294
+ offset += logits.numel()
295
+ state.view(torch.int64)[1] = offset
296
+ generator.set_state(state)
297
return random_sampled, logits_to_return
298
299