Fixed unit-test env var list parsing and improved filtered test run speed (#1626)

* Fixed parsing of env var lists which were overwriting the mutable env var string and polluting future parses.

* Fixed all tests to obey UT_DATATYPES and UT_REDOPS filters.

* Allow tests to bail early via `GTEST_SKIP` if UT_DATATYPES or UT_REDOPS filters give a test size of zero. This allows tests to run much faster with filters on.

* Wrapped the support checks in helper functions on `TestBed`.
This commit is contained in:
corey-derochie-amd
2025-12-10 10:06:44 -07:00
committed by GitHub
parent 6af9087b0c
commit 18e9ad913b
6 changed files with 126 additions and 38 deletions
+40 -24
View File
@@ -564,6 +564,40 @@ namespace RcclUnitTesting
return ev.GetAllSupportedDataTypes();
}
void TestBed::GetSupportedRedOps(std::vector<ncclRedOp_t>& redOps, const std::vector<ncclRedOp_t>& testRedOps)
{
// Filter out any unsupported reduction ops, in case only subset has been compiled for
auto& supportedOps = ev.GetAllSupportedRedOps();
for (auto redop : testRedOps)
{
for (int i = 0; i < supportedOps.size(); ++i)
{
if (supportedOps[i] == redop)
{
redOps.push_back(redop);
break;
}
}
}
}
void TestBed::GetSupportedDataTypes(std::vector<ncclDataType_t>& dataTypes, const std::vector<ncclDataType_t>& testDataTypes)
{
// Filter out any unsupported datatypes, in case only subset has been compiled for
auto& supportedDataTypes = ev.GetAllSupportedDataTypes();
for (auto dt : testDataTypes)
{
for (int i = 0; i < supportedDataTypes.size(); ++i)
{
if (supportedDataTypes[i] == dt)
{
dataTypes.push_back(dt);
break;
}
}
}
}
std::vector<int> const TestBed::GetNumCollsPerGroup(int numCollectivesInGroup,
int numGroupCalls)
{
@@ -642,34 +676,16 @@ namespace RcclUnitTesting
std::vector<int> sortedN = numElements;
std::sort(sortedN.rbegin(), sortedN.rend());
OptionalColArgs optionalArgs;
// Filter out any unsupported datatypes, in case only subset has been compiled for
std::vector<ncclDataType_t> const& supportedDataTypes = this->GetAllSupportedDataTypes();
std::vector<ncclDataType_t> dataTypes;
for (auto dt : tmpDataTypes)
{
for (int i = 0; i < supportedDataTypes.size(); ++i)
{
if (supportedDataTypes[i] == dt)
{
dataTypes.push_back(dt);
break;
}
}
this->GetSupportedDataTypes(dataTypes, tmpDataTypes);
if (dataTypes.empty()) {
GTEST_SKIP() << "Skipping... test datatypes excluded by UT_DATATYPES.";
}
// Filter out any unsupported reduction ops, in case only subset has been compiled for
std::vector<ncclRedOp_t> const& supportedOps = this->GetAllSupportedRedOps();
std::vector<ncclRedOp_t> redOps;
for (auto redop : tmpRedOps)
{
for (int i = 0; i < supportedOps.size(); ++i)
{
if (supportedOps[i] == redop)
{
redOps.push_back(redop);
break;
}
}
this->GetSupportedRedOps(redOps, tmpRedOps);
if (redOps.empty()) {
GTEST_SKIP() << "Skipping... test reduction operations excluded by UT_REDOPS.";
}
bool isCorrect = true;