Eliovp / amdmemorytweak

Read and modify memory timings on the fly
GNU General Public License v3.0
308 stars 81 forks source link

bug detecting card in pci_find_instance ? #37

Closed pigfrown closed 5 years ago

pigfrown commented 5 years ago

I get the following error message when running the latest version

Cannot find DRI instance for pci:0000:01:00.0

On my system /sys/kernel/debug/dri/$X/name is an empty file, but pci_find_instance seems to expect there to be something in there. This is causing the above error (if I understand correctly).

On my test system there are 5 cards, and they are numbered 0-5 in /sys/kernel/debug/dri/ , so I removed the call to pci_find_instance entirely and replaced

int instance = pci_find_instance(buffer);

at line 1505 with

int instance = i;

and everything works as expected. However this doesn't work on all rigs.

My test system has Lexa rx550's in it, so I also had to add dev->device_id == 0x699f) || // Lexa [Radeon RX550] to IsRelevantDeviceID to get everything working. I get the same problem on a a 580/570 rig though (exactly the same kernel/amdgpu-pro version).

System details:

Ubuntu 16.04, kernel 4.4.0 amdgpu-pro 18.10-572953

Thanks

mDog288 commented 5 years ago

Мой английский плох как и С, но для себя я нашел выход с драйвером 18.10 (почему-то майнинг на ethash с более свежим драйвером менее производителен) и интегрированной видеокартой. смысл в том что в оригинале из файла /sys/kernel/debug/dri/%s/name берется pci порт устройства, я же сравниваю только название драйвера для устройства. может работать не корректно, используйте на свой страх и риск))

--- AmdMemTweak.cpp.orig    2019-06-13 10:42:59.000000000 +0300
+++ AmdMemTweak.cpp 2019-06-13 14:31:30.576992117 +0300
@@ -775,24 +775,15 @@
        if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) continue;

        char name[300];
-       snprintf(name, sizeof(name) - 1, "/sys/kernel/debug/dri/%s/name", entry->d_name);
+       snprintf(name, sizeof(name) - 1, "/sys/class/hwmon/hwmon%s/name", entry->d_name);
        FILE * f = fopen(name, "r");
        if (!f) continue;

-       char device[256];
-       device[sizeof(device) - 1] = 0;
-       int parsed_device = fscanf(f, "%*s %255s", device);
+       char device [256];
+       fscanf(f, "%s", device);
        fclose(f);

-       if (parsed_device != 1) continue;
-
-       // strip off dev= for kernels > 4.7
-       if (strstr(device, "dev="))
-       {
-           memmove(device, device + 4, strlen(device) - 3);
-       }
-
-       if (!strcmp(pci_string, device))
+       if (!strcmp(device, "amdgpu"))
        {
            closedir(dir);
            return atoi(entry->d_name);

патч работает, но применяет параметры сразу ко всем ГПУ, игнорирует параметр --i((

Eliovp commented 5 years ago

Yeah, your issue is mainly due to onboard vga or an unknown gpu.

There's a fork here with a fix to ignore onboard vga. i'll see to add it here

mDog288 commented 5 years ago

This solution does not work correctly, at the moment I am updating the system so that everything works without my modifications.

vinibali commented 3 years ago

This fork contains the workaround to skip some APUs or IGPs: https://gitlab.com/vinibali/amdmemorytweak/-/tree/0.2.3_mod I added AMD's 690G to the list, because I had the same problem with this chipset!