[https://nvbugs/6426852][fix] Add explicit gc.collect() between del weights and… - #16144
Open
trtllm-agent wants to merge 1 commit into
Open
[https://nvbugs/6426852][fix] Add explicit gc.collect() between del weights and…#16144trtllm-agent wants to merge 1 commit into
gc.collect() between del weights and…#16144trtllm-agent wants to merge 1 commit into
Conversation
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughAdds an explicit ChangesCUDA IPC weight update fix
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
trtllm-agent
force-pushed
the
repair-bot-bug6426852
branch
from
July 13, 2026 09:39
9821ab7 to
ff85e5d
Compare
trtllm-agent
force-pushed
the
repair-bot-bug6426852
branch
from
July 20, 2026 11:49
ff85e5d to
8a94d16
Compare
trtllm-agent
requested review from
ZhanruiSunCh,
asfiyab-nvidia,
brnguyen2,
jieli-matrix and
tburt-nv
July 20, 2026 11:49
jieli-matrix
approved these changes
Jul 21, 2026
Partial-update loops on MoE models (Qwen3-30B-A3B) issue many per-suffix update_weights RPCs. Each RPC's worker side reconstructs CUDA IPC tensors via rebuild_cuda_tensor (cudaIpcOpenMemHandle) into 'weights', then drops the dict. Without an explicit gc.collect(), the underlying storages (backed by IPC mappings) can linger in unreachable cycles until the next full GC, so the following torch.cuda.ipc_collect() finds nothing to reclaim and the CUDA driver's IPC handle table saturates before the finalize step, producing cudaErrorMapBufferObjectFailed on later RPCs. Add gc.collect() between 'del weights' and 'torch.cuda.ipc_collect()' in WorkerExtension.update_weights so IPC-mapped storages are actually released before the CUDA IPC pool sweep in each iteration. Signed-off-by: trtllm-agent <296075020+trtllm-agent@users.noreply.github.com>
trtllm-agent
force-pushed
the
repair-bot-bug6426852
branch
from
July 22, 2026 14:01
8a94d16 to
701d5eb
Compare
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
del weightsalone left the mapped storages in unreachable cycles; many partial-update RPCs on MoE model exhausted CUDA driver's IPC handle table.gc.collect()betweendel weightsandtorch.cuda.ipc_collect()in the per-RPC branch so IPC-mapped storages are released in the same iteration, complementing the prior producer-side lazy-replica fix.Test plan
Links
Summary by CodeRabbit
Bug Fixes
Tests