Fix for inconsistent GPU indexing between rocm-smi and rbt/hip.
Signed-off-by: Divya Shikre <DivyaUday.Shikre@amd.com>
Change-Id: I0d966c91bfe0f0d51859ff098d15011a3e4e8b29
[ROCm/rocm_smi_lib commit: 47ca37aef7]
This commit is contained in:
کامیت شده توسط
Divya Uday Shikre
والد
be455127c2
کامیت
9f37923767
@@ -461,6 +461,7 @@ static bool isAMDGPU(std::string dev_path) {
|
||||
uint32_t RocmSMI::DiscoverAmdgpuDevices(void) {
|
||||
uint32_t ret = 0;
|
||||
std::string err_msg;
|
||||
uint32_t count = 0;
|
||||
|
||||
// If this gets called more than once, clear previous findings.
|
||||
devices_.clear();
|
||||
@@ -486,18 +487,26 @@ uint32_t RocmSMI::DiscoverAmdgpuDevices(void) {
|
||||
while (dentry != nullptr) {
|
||||
if (memcmp(dentry->d_name, kDeviceNamePrefix, strlen(kDeviceNamePrefix))
|
||||
== 0) {
|
||||
std::string vend_str_path = kPathDRMRoot;
|
||||
vend_str_path += "/";
|
||||
vend_str_path += dentry->d_name;
|
||||
|
||||
if (isAMDGPU(vend_str_path) ||
|
||||
(init_options_ & RSMI_INIT_FLAG_ALL_GPUS)) {
|
||||
AddToDeviceList(dentry->d_name);
|
||||
}
|
||||
if ((strcmp(dentry->d_name, ".") == 0) ||
|
||||
(strcmp(dentry->d_name, "..") == 0))
|
||||
continue;
|
||||
count++;
|
||||
}
|
||||
dentry = readdir(drm_dir);
|
||||
}
|
||||
|
||||
for (uint32_t node_id = 0; node_id < count; node_id++) {
|
||||
std::string path = kPathDRMRoot;
|
||||
path += "/card";
|
||||
path += std::to_string(node_id);
|
||||
if (isAMDGPU(path) ||
|
||||
(init_options_ & RSMI_INIT_FLAG_ALL_GPUS)) {
|
||||
std::string d_name = "card";
|
||||
d_name += std::to_string(node_id);
|
||||
AddToDeviceList(d_name);
|
||||
}
|
||||
}
|
||||
|
||||
if (closedir(drm_dir)) {
|
||||
err_msg = "Failed to close drm root directory ";
|
||||
err_msg += kPathDRMRoot;
|
||||
|
||||
مرجع در شماره جدید
Block a user