SWDEV-1 fix issues seen due to test sharding (#1134)
이 커밋은 다음에 포함됨:
@@ -172,7 +172,30 @@ TEST_CASE("Unit_hipDeviceGetPCIBusId_MaskedDevices") {
|
|||||||
/* Compare {pciDomainID, pciBusID, pciDeviceID} values
|
/* Compare {pciDomainID, pciBusID, pciDeviceID} values
|
||||||
* hipDeviceGetPCIBusId vs lspci
|
* hipDeviceGetPCIBusId vs lspci
|
||||||
*/
|
*/
|
||||||
|
|
||||||
TEST_CASE("Unit_hipDeviceGetPCIBusId_CheckPciBusIDWithLspci") {
|
TEST_CASE("Unit_hipDeviceGetPCIBusId_CheckPciBusIDWithLspci") {
|
||||||
|
auto are_devices_hidden = []() -> bool {
|
||||||
|
#if HT_AMD
|
||||||
|
auto env_res = std::getenv("HIP_VISIBLE_DEVICES");
|
||||||
|
if (env_res == nullptr) {
|
||||||
|
env_res = std::getenv("ROCR_VISIBLE_DEVICES");
|
||||||
|
if (env_res == nullptr) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
auto env_res = std::getenv("HIP_VISIBLE_DEVICES");
|
||||||
|
return env_res != nullptr;
|
||||||
|
#endif
|
||||||
|
}();
|
||||||
|
|
||||||
|
if (are_devices_hidden) {
|
||||||
|
HipTest::HIP_SKIP_TEST(
|
||||||
|
"There are hidden devices, which means lscpi might report something different than what we "
|
||||||
|
"have here");
|
||||||
|
}
|
||||||
|
|
||||||
FILE* fpipe;
|
FILE* fpipe;
|
||||||
{
|
{
|
||||||
// Check if lspci is installed, if not, don't proceed
|
// Check if lspci is installed, if not, don't proceed
|
||||||
|
|||||||
@@ -179,6 +179,25 @@ TEST_CASE("Unit_hipDeviceGetName_PartialFill") {
|
|||||||
#if HT_AMD
|
#if HT_AMD
|
||||||
#define BUFFER_LEN 512
|
#define BUFFER_LEN 512
|
||||||
|
|
||||||
|
static inline std::vector<int> parseVisibleDevices() {
|
||||||
|
std::vector<int> res;
|
||||||
|
auto env_res = std::getenv("HIP_VISIBLE_DEVICES");
|
||||||
|
if (env_res == nullptr) {
|
||||||
|
env_res = std::getenv("ROCR_VISIBLE_DEVICES");
|
||||||
|
if (env_res == nullptr) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::stringstream ss(std::string{env_res});
|
||||||
|
std::string item;
|
||||||
|
while (std::getline(ss, item, ',')) {
|
||||||
|
res.push_back(std::stoi(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Description
|
* Test Description
|
||||||
* ------------------------
|
* ------------------------
|
||||||
@@ -223,6 +242,17 @@ TEST_CASE("Unit_hipDeviceName_gcnArchName_And_rocm_agent_enumerator") {
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto visible_devices = parseVisibleDevices();
|
||||||
|
if (visible_devices.size() > 0) {
|
||||||
|
// We have visible devices set, basically parse the visible devices and remove the entries
|
||||||
|
size_t start = 0; // The devices will be reported from 0..
|
||||||
|
std::map<int, std::vector<char>> dNameMapCopy;
|
||||||
|
for (auto device : visible_devices) {
|
||||||
|
dNameMapCopy[start] = dNameMap[device];
|
||||||
|
}
|
||||||
|
dNameMap = dNameMapCopy;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& i : dNameMap) {
|
for (const auto& i : dNameMap) {
|
||||||
if (i.second.size() == 0) {
|
if (i.second.size() == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -114,6 +114,26 @@ TEST_CASE("Unit_hipDeviceGetUuid_Negative") {
|
|||||||
}
|
}
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#if HT_AMD
|
#if HT_AMD
|
||||||
|
|
||||||
|
static inline std::vector<int> parseVisibleDevices() {
|
||||||
|
std::vector<int> res;
|
||||||
|
auto env_res = std::getenv("HIP_VISIBLE_DEVICES");
|
||||||
|
if (env_res == nullptr) {
|
||||||
|
env_res = std::getenv("ROCR_VISIBLE_DEVICES");
|
||||||
|
if (env_res == nullptr) {
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::stringstream ss(std::string{env_res});
|
||||||
|
std::string item;
|
||||||
|
while (std::getline(ss, item, ',')) {
|
||||||
|
res.push_back(std::stoi(item));
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test Description
|
* Test Description
|
||||||
* ------------------------
|
* ------------------------
|
||||||
@@ -161,6 +181,17 @@ TEST_CASE("Unit_hipDeviceGetUuid_From_RocmInfo") {
|
|||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto visible_devices = parseVisibleDevices();
|
||||||
|
if (visible_devices.size() > 0) {
|
||||||
|
// We have visible devices set, basically parse the visible devices and remove the entries
|
||||||
|
size_t start = 0; // The devices will be reported from 0..
|
||||||
|
std::map<int, std::vector<char>> uuid_map_copy;
|
||||||
|
for (auto device : visible_devices) {
|
||||||
|
uuid_map_copy[start] = uuid_map[device];
|
||||||
|
}
|
||||||
|
uuid_map = uuid_map_copy;
|
||||||
|
}
|
||||||
|
|
||||||
for (const auto& i : uuid_map) {
|
for (const auto& i : uuid_map) {
|
||||||
if (i.second.size() == 0) {
|
if (i.second.size() == 0) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
새 이슈에서 참조
사용자 차단