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
a8c92908
Commit
a8c92908
authored
Mar 22, 2025
by
xiabo
Browse files
add custom allreduce cudagraph
parent
2d6bccd9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
vllm/distributed/device_communicators/custom_all_reduce.py
vllm/distributed/device_communicators/custom_all_reduce.py
+5
-4
No files found.
vllm/distributed/device_communicators/custom_all_reduce.py
View file @
a8c92908
...
...
@@ -56,7 +56,7 @@ class CustomAllreduce:
def
__init__
(
self
,
group
:
ProcessGroup
,
device
:
Union
[
int
,
str
,
torch
.
device
],
max_size
=
8192
*
1024
)
->
None
:
max_size
=
8192
*
1024
*
2
)
->
None
:
"""
Args:
group: the process group to work on. If None, it will use the
...
...
@@ -90,6 +90,7 @@ class CustomAllreduce:
return
rank
=
dist
.
get_rank
(
group
=
self
.
group
)
self
.
rank
=
rank
world_size
=
dist
.
get_world_size
(
group
=
self
.
group
)
if
world_size
==
1
:
# No need to initialize custom allreduce for single GPU case.
...
...
@@ -291,7 +292,7 @@ class CustomAllreduce:
return
None
if
self
.
_IS_CAPTURING
:
if
torch
.
cuda
.
is_current_stream_capturing
():
return
self
.
all_reduce
(
input
,
registered
=
Tru
e
)
return
self
.
all_reduce
(
input
,
registered
=
Fals
e
)
else
:
# If warm up, mimic the allocation pattern since custom
# allreduce is out-of-place.
...
...
@@ -306,8 +307,8 @@ class CustomAllreduce:
if
not
self
.
disabled
and
self
.
_ptr
:
ops
.
dispose
(
self
.
_ptr
)
self
.
_ptr
=
0
self
.
free_shared_buffer
(
self
.
meta_ptrs
)
self
.
free_shared_buffer
(
self
.
buffer_ptrs
)
self
.
free_shared_buffer
(
self
.
meta_ptrs
,
rank
=
self
.
rank
)
self
.
free_shared_buffer
(
self
.
buffer_ptrs
,
rank
=
self
.
rank
)
def
__del__
(
self
):
self
.
close
()
...
...
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