clbr / radeontop

GNU General Public License v3.0
785 stars 69 forks source link

Port getamdgpuids to Kernel 6.1 #146

Closed danielzgtg closed 1 year ago

danielzgtg commented 1 year ago

The old getamdgpuids.sh doesn't work anymore on kernel 6.1. cpp complains about drm/ includes then asm/ includes and even after those -I are added it still complains about something in the compiler file. Even when the module is built by a normal kernel, it the "PCIAN" and "CHIP" patterns seem to have been changed away. This causes the old script to only keep adding nonsense like CHIPSET(,,).

I ported the getamdgpuids script to parse the C file instead. I included a lot of error checking in case the struct changes again. It works with Python3.10 on https://github.com/torvalds/linux/tree/2f5065a0bc9d0afb45f2ae284bd525d55ce82c33 .

clbr commented 1 year ago

Thank you for the effort, but I dislike python and will not add that dep. I feel bad to reject your PRs like this, maybe you could ask beforehand to avoid wasted work?

danielzgtg commented 1 year ago

It's ok. Python is a prototyping language and the average Python script is deleted after just 1 use.

ask [...] wasted

I am trying to get Navi23 supported added quickly. It's more like I wrote the script as a byproduct of following https://github.com/clbr/radeontop/pull/144#issuecomment-1304575948 saying they are imported automatically. Another project I'm working on also includes parsing so I had the ideas fresh in my mind already.

I was not confident in importing all those 26 IDs manually. Scripts don't make mistakes so I use them. Nobody except a computer would have noticed the "OLAND" part. I've written Javascript to parse Wikipedia that took 2+ hours only for me to delete it right away and never publish anything.

you could ask beforehand

I would have asked beforehand if I had to write awk or sed. It took me less than an hour to write this. I never cared about this pull request because it got the other pull request ready earlier. On the other hand it would probably take me 40+ reluctant hours to learn awk properly, and 20 hours to learn anything beyond basic sed. So basically, Bash/Python = I don't care about wasted time, awk/sed = I would care about wasted time.