Repository navigation
test(rccl): clamp isolated-test GPU pool to devices HIP can open #14944
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d61d04f
[AICOMRCCL-3520] [test] Clamp the isolated-test GPU pool to the devic…
mch 55c64ca
[AICOMRCCL-3520] [test] Probe the HIP device count in a fresh process…
mch eb23781
[AICOMRCCL-3520] [test] Give the pool-clamp rationale a single owner
mch 32f2053
Merge origin/develop into users/mahughes/aicomrccl-3520
mch 1c36c90
[AICOMRCCL-3520] [test] Keep an unclamped pool loud instead of silent
mch dce8856
[AICOMRCCL-3520] [test] Pin what the GPU-count probe returns
mch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
87 changes: 87 additions & 0 deletions
87
projects/rccl/test/host/process-isolated-runner-pool-test.cc
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| /************************************************************************* | ||
| * Copyright (c) 2025 Advanced Micro Devices, Inc. All rights reserved. | ||
| * | ||
| * See LICENSE.txt for license information | ||
| ************************************************************************/ | ||
|
|
||
| // Pool sizing in test/common/ProcessIsolatedTestRunner.cpp. | ||
| // | ||
| // The runner hands each isolated child a slice of its GPU pool via | ||
| // HIP_VISIBLE_DEVICES. Neither pool source can be trusted to describe the | ||
| // devices this process can open: KFD topology sysfs is not namespaced per | ||
| // container, and an inherited HIP_VISIBLE_DEVICES is just whatever the caller | ||
| // set. clampPoolToDeviceCount() is the one place that reconciles the detected | ||
| // pool with the device count HIP reports, so it is pinned here. | ||
|
|
||
| #include <gtest/gtest.h> | ||
|
|
||
| #include <vector> | ||
|
|
||
| #include "../common/ProcessIsolatedTestRunner.hpp" | ||
|
|
||
| namespace | ||
| { | ||
|
|
||
| using RcclUnitTesting::clampPoolToDeviceCount; | ||
|
|
||
| std::vector<int> poolOf(int n) | ||
| { | ||
| std::vector<int> pool(static_cast<size_t>(n)); | ||
| for(int i = 0; i < n; ++i) pool[static_cast<size_t>(i)] = i; | ||
| return pool; | ||
| } | ||
|
|
||
| // The CI case: an 8-GPU host topology seen from a container where HIP can open | ||
| // four devices. Ordinals >= 4 must never reach a child. | ||
| TEST(ProcessIsolatedRunnerPool, TruncatesPoolToTheDeviceCountHipReports) | ||
| { | ||
| EXPECT_EQ(clampPoolToDeviceCount(poolOf(8), 4), (std::vector<int>{0, 1, 2, 3})); | ||
| } | ||
|
|
||
| TEST(ProcessIsolatedRunnerPool, KeepsPoolWhenHipReportsAsManyDevicesAsTheSource) | ||
| { | ||
| EXPECT_EQ(clampPoolToDeviceCount(poolOf(4), 4), poolOf(4)); | ||
| } | ||
|
|
||
| // A pool smaller than the machine is a deliberate restriction (for example an | ||
| // explicit HIP_VISIBLE_DEVICES); the clamp must not widen it back out. | ||
| TEST(ProcessIsolatedRunnerPool, KeepsPoolWhenHipReportsMoreDevicesThanTheSource) | ||
| { | ||
| EXPECT_EQ(clampPoolToDeviceCount(poolOf(2), 8), poolOf(2)); | ||
| } | ||
|
|
||
| // HIP exposes the longest valid prefix of HIP_VISIBLE_DEVICES and reports its | ||
| // length, so the kept entries are the leading ones in source order, whatever | ||
| // ids those happen to be. | ||
| TEST(ProcessIsolatedRunnerPool, KeepsTheLeadingSourceIdsInSourceOrder) | ||
| { | ||
| EXPECT_EQ(clampPoolToDeviceCount({3, 1, 7, 5}, 2), (std::vector<int>{3, 1})); | ||
| } | ||
|
|
||
| // The ids are absolute device numbers, not offsets into the pool, and a count | ||
| // equal to the pool's length means every one of them is openable. Discarding | ||
| // ids >= the count instead of trimming by length would empty this pool, which | ||
| // is what an 8-GPU host restricted to HIP_VISIBLE_DEVICES=4,5,6,7 looks like. | ||
| TEST(ProcessIsolatedRunnerPool, KeepsIdsAboveTheDeviceCountWhenAllOfThemAreVisible) | ||
| { | ||
| EXPECT_EQ(clampPoolToDeviceCount({4, 5, 6, 7}, 4), (std::vector<int>{4, 5, 6, 7})); | ||
| } | ||
|
|
||
| // A failed probe and a genuinely GPU-less machine both leave the pool alone: | ||
| // emptying it would turn a per-test skip into a pool-detection failure. | ||
| TEST(ProcessIsolatedRunnerPool, KeepsPoolWhenTheDeviceCountIsUnknown) | ||
| { | ||
| EXPECT_EQ(clampPoolToDeviceCount(poolOf(8), -1), poolOf(8)); | ||
| } | ||
|
|
||
| TEST(ProcessIsolatedRunnerPool, KeepsPoolWhenHipReportsNoDevices) | ||
| { | ||
| EXPECT_EQ(clampPoolToDeviceCount(poolOf(8), 0), poolOf(8)); | ||
| } | ||
|
|
||
| TEST(ProcessIsolatedRunnerPool, LeavesAnUndetectedPoolEmpty) | ||
| { | ||
| EXPECT_TRUE(clampPoolToDeviceCount({}, 8).empty()); | ||
| } | ||
|
|
||
| } // namespace |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.