mirror of
https://github.com/kvcache-ai/sglang.git
synced 2026-11-05 01:07:39 +00:00
[PR #27] [fix](kt): Fix barrier call to use cpu_group instead of device_group #28
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/sglang#28
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/kvcache-ai/sglang/pull/27
Author: @SCDESPERTATE
Created: 3/12/2026
Status: 🔄 Open
Base:
main← Head:fix/layerwise_prefill_barrier_usage📝 Commits (1)
00bdcd7fix: change the device_group to cpu_group inbarriercall📊 Changes
1 file changed (+7 additions, -11 deletions)
View changed files
📝
python/sglang/srt/layers/moe/kt_ep_wrapper.py(+7 -11)📄 Description
Summary
The comment in the
GroupCoordinator.barriermethod inparallel_state.pyexplicitly states: "don't use device_group here." However, the current implementation frequently usesdevice_groupindist.barriercalls, which introduces unnecessary latency during the expert transfer process in layerwise-prefill. This latency scales with both the number of layers and the number of experts per layer, degrading performance.Profling
On a system with
Quadro RTX 5000x1 andPyTorch 2.7.1, usingdevice_groupindist.barrieradds around 75 microseconds of latency per expert transfer compare with usingcpu_group. For a model like Qwen3-30B-A3B (128 experts per layer, 48 layers), this accumulates to nearly 460.8ms of additional overhead.Modifications
Replace the explicit
dist.barrier(group=get_tp_group().device_group)call with the already wrappedGroupCoordinator.barriermethod which usecpu_groupinside.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.