Repository navigation
Fix stream ownership and resource cleanup - #940
Merged
Changho Hwang (chhwang) merged 4 commits intoNov 5, 2026
Merged
Changho Hwang (chhwang) merged 4 commits into
Changho Hwang (chhwang) merged 4 commits into
Conversation
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Changho Hwang (chhwang)
marked this pull request as ready for review
November 3, 2026 06:30
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the stream-ownership, resource-cleanup, and empty-buffer changes.
No open issues 🎉
What changed in this PR
This PR tightens GPU stream ownership and resource cleanup in MSCCL++ utilities while defining predictable empty-buffer behavior.
Changes:
- Makes both stream wrappers non-copyable to prevent duplicate destruction or pool returns; no move API is added.
- Frees acquired InfiniBand device lists and returns zero when acquisition fails.
- Initializes empty GPU buffers with zero bytes and device ID
-1, documents the behavior, and adds regression assertions.
| File | Description |
|---|---|
test/unit/gpu_utils_tests.cc |
Adds compile-time non-copyability checks and empty-buffer assertions. |
src/core/ib.cc |
Releases the device list and handles null acquisition. |
include/mscclpp/gpu_utils.hpp |
Deletes stream copy operations and initializes and documents empty-buffer state. |
Review effort: Balanced
Binyang Li (Binyang2014)
approved these changes
Nov 4, 2026
Changho Hwang (chhwang)
deleted the
fix/stream-ownership-and-resource-cleanup-20261026
branch
November 5, 2026 00:44
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
CudaStreamWithFlagsandGpuStreamnon-copyable to prevent duplicate stream destruction and returning a pool lease more than once. No move API is added; current direct-prvalue return usage remains valid under C++20 guaranteed copy elision. This intentionally breaks callers that copy either type, includingstd::moveexpressions that previously fell back to copying.getIBDeviceCount()and return zero if list acquisition returns null.GpuBufferstate with zero bytes anddeviceId() == -1, document that behavior, and extend the existing GPU-utils test.Validation
unit_testsandmp_unit_teststargets with CUDA 12.9, C++20, and IB enabled; ownershipstatic_asserts compiled.GpuUtilsTest.StreamPoolandGpuUtilsTest.AllocSharedeach passed with exactly one filtered test selected. The latter includes the empty-buffer assertions.This PR does not add locks, reference counting, synchronization, allocator changes, or benchmark/performance claims.