Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
d2fdeac2
"src/git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "3d2648d743e4257c550bba03242486b1f3834838"
Commit
d2fdeac2
authored
Nov 03, 2025
by
maxiao1
Browse files
调用vllm里custom all reduce
parent
75cd34d1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
4 deletions
+8
-4
python/sglang/srt/_custom_ops.py
python/sglang/srt/_custom_ops.py
+6
-2
python/sglang/srt/distributed/device_communicators/custom_all_reduce.py
...srt/distributed/device_communicators/custom_all_reduce.py
+2
-1
python/sglang/srt/distributed/parallel_state.py
python/sglang/srt/distributed/parallel_state.py
+0
-1
No files found.
python/sglang/srt/_custom_ops.py
View file @
d2fdeac2
...
@@ -22,9 +22,11 @@ use_vllm_custom_allreduce = get_bool_env_var(
...
@@ -22,9 +22,11 @@ use_vllm_custom_allreduce = get_bool_env_var(
if
not
is_hpu
():
if
not
is_hpu
():
# ROCm does not use vllm custom allreduce
# ROCm does not use vllm custom allreduce
if
use_vllm_custom_allreduce
and
not
is_hip
():
# if use_vllm_custom_allreduce and not is_hip():
if
use_vllm_custom_allreduce
:
try
:
try
:
import
vllm._C
# noqa: F401
import
vllm._C
# noqa: F401
print
(
"[DEBUG] ✅ Using vLLM custom allreduce (vllm._C successfully imported)"
)
except
ImportError
as
e
:
except
ImportError
as
e
:
logger
.
warning
(
"Failed to import from vllm._C with %r"
,
e
)
logger
.
warning
(
"Failed to import from vllm._C with %r"
,
e
)
else
:
else
:
...
@@ -34,9 +36,11 @@ if not is_hpu():
...
@@ -34,9 +36,11 @@ if not is_hpu():
logger
.
warning
(
"Failed to import from custom_ar with %r"
,
e
)
logger
.
warning
(
"Failed to import from custom_ar with %r"
,
e
)
if
not
is_hip
()
and
not
is_npu
():
# if not is_hip() and not is_npu():
if
not
is_npu
():
if
use_vllm_custom_allreduce
:
if
use_vllm_custom_allreduce
:
custom_op
=
torch
.
ops
.
_C_custom_ar
custom_op
=
torch
.
ops
.
_C_custom_ar
print
(
"[DEBUG] ✅ custom_op = torch.ops._C_custom_ar (vLLM path active)"
)
else
:
else
:
custom_op
=
sgl_kernel
.
allreduce
custom_op
=
sgl_kernel
.
allreduce
...
...
python/sglang/srt/distributed/device_communicators/custom_all_reduce.py
View file @
d2fdeac2
...
@@ -27,7 +27,8 @@ _is_hip = is_hip()
...
@@ -27,7 +27,8 @@ _is_hip = is_hip()
try
:
try
:
if
ops
.
use_vllm_custom_allreduce
and
not
_is_hip
:
# if ops.use_vllm_custom_allreduce and not _is_hip:
if
ops
.
use_vllm_custom_allreduce
:
# Use vLLM custom allreduce
# Use vLLM custom allreduce
ops
.
meta_size
()
ops
.
meta_size
()
else
:
else
:
...
...
python/sglang/srt/distributed/parallel_state.py
View file @
d2fdeac2
...
@@ -1539,7 +1539,6 @@ def initialize_model_parallel(
...
@@ -1539,7 +1539,6 @@ def initialize_model_parallel(
group_name
=
"tp"
,
group_name
=
"tp"
,
pynccl_use_current_stream
=
duplicate_tp_group
,
pynccl_use_current_stream
=
duplicate_tp_group
,
torch_compile
=
torch_compile
,
torch_compile
=
torch_compile
,
use_custom_allreduce
=
False
,
)
)
if
duplicate_tp_group
:
if
duplicate_tp_group
:
...
...
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