Repository navigation
[fix] IPC barrier - #2114
Open
PengchengShi00 wants to merge 2 commits into
Open
[fix] IPC barrier#2114PengchengShi00 wants to merge 2 commits into
PengchengShi00 wants to merge 2 commits into
Conversation
Collaborator
Author
|
@claude review |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LMDeploy IPC 按 dtype 缓存一块 GPU buffer,后续 bucket 是 copy 进同一块,对端读的也是这块。
代码改动:
LMDeployIPCBackendAdapter.after_update_per_batch从finished or (train_enable_ep and rollout_tp > 1)改为finished or rollout_tp > 1。即 只要 TP>1,每个中间 batch 都 barrier,非 head 等到 head HTTP 回来再写下一拍。顺带去掉每个 submodule group 后的 empty_cache(),正确性改靠 barrier,不再依赖 allocator 副作用。
这是 LMDeploy 持久化 buffer 特有的「同一块还活着的 IPC 页被写下一批」。
SGLang / vLLM IPC:没有 pin 住的 buffer。每个 bucket 会 cat 出新的 flattened / reduce_tensor,发完引用就可以没了,不会主动 copy 进「上一拍那块还在被对端 map 的 tensor」。因此没有这次修的那条竞态。
NCCL / checkpoint-engine:不复用 CUDA IPC handle 指向的同一块 sender buffer,接收端自己的内存,没有这条写覆盖。
共卡(IPC)和分离部署(NCCL)都加了 generate 正确性检查,覆盖 SGLang 和 LMDeploy:
同一引擎 greedy generate 两次(确认引擎自身可复现)
权重更新(无训练 step)
再 generate,和第一次比 response / response_ids / sampled-token logprobs(atol/rtol=1e-5)
LMDeploy /generate 写死 do_sample=True,greedy 用 top_k=1 且 temperature=1.0(temperature=0 会除零)。SGLang greedy 仍用 temperature=0。
checkpoint 检查(SGLang WeightChecker)是互补用例,依赖私有 patch,默认 skip。