Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
4af9ed21
Unverified
Commit
4af9ed21
authored
Mar 17, 2026
by
zhao, zhenhui
Committed by
GitHub
Mar 17, 2026
Browse files
[Bugfix](xpu): prevent “selected index k out of range” in TP decode path (#37259)
Signed-off-by:
zhenzhao
<
zhenzhao@habana.ai
>
parent
9c7cab5e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
1 deletion
+2
-1
vllm/_xpu_ops.py
vllm/_xpu_ops.py
+2
-1
No files found.
vllm/_xpu_ops.py
View file @
4af9ed21
...
...
@@ -426,7 +426,8 @@ class xpu_ops:
mask
=
positions
<=
index_end_pos
# mask: [B * N, L]
logits
=
logits
.
masked_fill
(
~
mask
,
float
(
"-inf"
))
topk_indices
=
logits
.
topk
(
topk_tokens
,
dim
=-
1
)[
1
].
to
(
torch
.
int32
)
# [B * N, K]
real_topk
=
min
(
topk_tokens
,
logits
.
shape
[
-
1
])
topk_indices
=
logits
.
topk
(
real_topk
,
dim
=-
1
)[
1
].
to
(
torch
.
int32
)
# [B * N, K]
# ensure we don't set indices for the top k
# that is out of range(masked already)
# this will happen if context length is shorter than K
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment