@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / 71d810bbf4
Fork 0

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 2, 20:45 UTC

[XPU] Ensure RNG offset alignment with PyTorch requirements in XPU sampler (#43028)

Signed-off-by: chaojun-zhang <chaojun.zhang@intel.com> Signed-off-by: Chaojun Zhang <chaojun.zhang@intel.com> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>

Chaojun Zhang committed May 26, 2026 at 10:01 UTC 71d810bbf44b34f3a019730a6878fbcbf2480499
1 file changed +2 -1
vllm/v1/sample/ops/topk_topp_sampler.py
+2 -1
@@ -291,7 +291,8 @@ class TopKTopPSampler(nn.Module):
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()
294 + # pytorch: offset must be multiple of 4
295 + offset = (offset + logits.numel() + 3) // 4 * 4
296 state.view(torch.int64)[1] = offset
297 generator.set_state(state)
298 return random_sampled, logits_to_return