Skip to content

Commit d70c96e

Browse files
committed
Fixed upstream bugs, and fixed local issue with igpu/dgpu separation
1 parent af54613 commit d70c96e

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/cpp/server/system_info.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,9 @@ std::vector<GPUInfo> LinuxSystemInfo::detect_amd_gpus(const std::string& gpu_typ
13211321
if (!is_gpu || drm_render_minor.empty() || drm_render_minor == "-1")
13221322
continue;
13231323

1324+
bool is_integrated = get_amd_is_igpu(drm_render_minor);
1325+
if ((gpu_type == "integrated" && !is_integrated) || (gpu_type == "discrete" && is_integrated)) continue;
1326+
13241327
GPUInfo gpu;
13251328
gpu.name = gfx_target_version;
13261329
gpu.available = true;
@@ -1330,17 +1333,17 @@ std::vector<GPUInfo> LinuxSystemInfo::detect_amd_gpus(const std::string& gpu_typ
13301333
gpu.dynamic_gb = get_amd_dynamic_vram(drm_render_minor);
13311334

13321335
// Detect inference engines
1333-
std::string device_type = get_amd_is_igpu(drm_render_minor) ? "amd_igpu" : "amd_dgpu";
1336+
std::string device_type = is_integrated ? "amd_igpu" : "amd_dgpu";
13341337
gpu.inference_engines = detect_inference_engines(device_type, gfx_target_version);
13351338

13361339
gpus.push_back(gpu);
1340+
}
13371341

1338-
if (gpus.empty()) {
1339-
GPUInfo gpu;
1340-
gpu.available = false;
1341-
gpu.error = "No AMD " + gpu_type + " GPU found in KFD nodes";
1342-
gpus.push_back(gpu);
1343-
}
1342+
if (gpus.empty()) {
1343+
GPUInfo gpu;
1344+
gpu.available = false;
1345+
gpu.error = "No AMD " + gpu_type + " GPU found in KFD nodes";
1346+
gpus.push_back(gpu);
13441347
}
13451348

13461349
return gpus;
@@ -1472,7 +1475,7 @@ double LinuxSystemInfo::get_dynamic_vram() {
14721475
bool LinuxSystemInfo::get_amd_is_igpu(const std::string& drm_render_minor) {
14731476
std::string device_path = "/sys/class/drm/renderD" + drm_render_minor + "/device/";
14741477
std::string board_info_path = device_path + "board_info";
1475-
return !fs::exists(board_info_path) && fs::is_regular_file(board_info_path);
1478+
return !(fs::exists(board_info_path) && fs::is_regular_file(board_info_path));
14761479
}
14771480

14781481
double LinuxSystemInfo::parse_vram_sysfs(const std::string& drm_render_minor, const std::string& deviceFile){

0 commit comments

Comments
 (0)