When available (i.e. using vulkan), check vendor/device id and skip device if no match

pull/771/head
jackun 2 years ago
parent ac7c898ba7
commit f4cbb8b14b
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -629,17 +629,26 @@ void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_para
for (auto& dir : dirs) {
path = drm + dir;
SPDLOG_DEBUG("amdgpu path check: {}/device/vendor", path);
SPDLOG_DEBUG("amdgpu path check: {}", path);
if (pci_bus_parsed && pci_dev) {
string pci_device = read_symlink((path + "/device").c_str());
SPDLOG_DEBUG("PCI device symlink: '{}'", pci_device);
if (!ends_with(pci_device, pci_dev)) {
SPDLOG_DEBUG("skipping GPU, no PCI ID match");
continue;
}
}
FILE *fp;
string device = path + "/device/device";
if ((fp = fopen(device.c_str(), "r"))){
uint32_t temp = 0;
if (fscanf(fp, "%x", &temp) == 1) {
// if (temp != reported_deviceID && deviceID != 0){
// fclose(fp);
// SPDLOG_DEBUG("DeviceID does not match vulkan report {}", reported_deviceID);
// continue;
// }
if (reported_deviceID && temp != reported_deviceID){
fclose(fp);
SPDLOG_DEBUG("DeviceID does not match vulkan report {}", reported_deviceID);
continue;
}
deviceID = temp;
}
fclose(fp);
@ -655,15 +664,6 @@ void init_gpu_stats(uint32_t& vendorID, uint32_t reported_deviceID, overlay_para
fclose(fp);
}
if (pci_bus_parsed && pci_dev) {
string pci_device = read_symlink((path + "/device").c_str());
SPDLOG_DEBUG("PCI device symlink: '{}'", pci_device);
if (!ends_with(pci_device, pci_dev)) {
SPDLOG_DEBUG("skipping GPU, no PCI ID match");
continue;
}
}
const std::string device_path = path + "/device";
const std::string gpu_metrics_path = device_path + "/gpu_metrics";
if (amdgpu_check_metrics(gpu_metrics_path)) {

Loading…
Cancel
Save