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
64466778
Unverified
Commit
64466778
authored
Aug 27, 2025
by
Kunshang Ji
Committed by
GitHub
Aug 27, 2025
Browse files
[XPU]fix cuda event used in XPU model runner (#23708)
Signed-off-by:
Kunshang Ji
<
kunshang.ji@intel.com
>
parent
69244e67
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
vllm/v1/worker/xpu_model_runner.py
vllm/v1/worker/xpu_model_runner.py
+21
-1
No files found.
vllm/v1/worker/xpu_model_runner.py
View file @
64466778
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
from
contextlib
import
contextmanager
from
typing
import
TYPE_CHECKING
import
torch
...
...
@@ -22,6 +23,7 @@ class XPUModelRunner(GPUModelRunner):
vllm_config
:
VllmConfig
,
device
:
torch
.
device
,
):
with
_torch_cuda_wrapper
():
super
().
__init__
(
vllm_config
,
device
)
# FIXME: To be verified.
self
.
cascade_attn_enabled
=
False
...
...
@@ -31,3 +33,21 @@ class XPUModelRunner(GPUModelRunner):
def
_sync_device
(
self
)
->
None
:
torch
.
xpu
.
synchronize
()
@
contextmanager
def
_torch_cuda_wrapper
():
class
_EventPlaceholder
:
def
__init__
(
self
,
*
args
,
**
kwargs
)
->
None
:
self
.
record
=
lambda
:
None
self
.
synchronize
=
lambda
:
None
try
:
# replace cuda Event with xpu Event, this should work by default
torch
.
cuda
.
Event
=
torch
.
xpu
.
Event
yield
finally
:
# if anything goes wrong, just patch it with a placeholder
torch
.
cuda
.
Event
=
_EventPlaceholder
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