Possibly missing AMD driver module?

Nah folder shouldn’t affect it; :thinking: that’s a strange error cuz that file should definitely exist for an amd gpu

Ah, here we go, reviewing the code I made an obvious mistake that’s causing this (or rather I forgot to update some parts of the code from an earlier testing run).

Here’s a fixed version.

#!/bin/bash

#See: https://dri.freedesktop.org/docs/drm/gpu/amdgpu.html
#For overclocking see: https://wiki.archlinux.org/title/AMDGPU#Overclocking
#I opted not to add overclocking capabilities to this script, because of the potential risk of overclocking via unmaintained scripts...

PCI_IDS=$(find /usr/share -maxdepth 2 -name "pci.ids" -print -quit)

DPM_LEVELS="auto;low;high;manual;profile_standard;profile_min_sclk;profile_min_mclk;profile_peak"

#If privilege escalation is required, use sudo for terminal and pkexec for ouside of terminal.
[ $EUID -ne 0 ] && SUDO=pkexec && tty -s && SUDO=sudo



echo
for CARD in /sys/class/drm/card[0-9]/device;
do
	source $CARD/uevent # Load PCI_ID
	IFS=: PCI_ID=(${PCI_ID,,}) PCI_SUBSYS_ID=(${PCI_SUBSYS_ID,,})
	VENDOR_DEVICELIST=$(awk "/^${PCI_ID[0]}/{a=1;next}/^....  /{a=0}a" $PCI_IDS)
	NAME=$(sed -n "0,/\s*${PCI_SUBSYS_ID[0]} ${PCI_SUBSYS_ID[1]}  /s///p" <<< $VENDOR_DEVICELIST)
	[ -z $NAME ] && NAME=$(sed -n "0,/\s*${PCI_ID[1]}  /s///p" <<< $VENDOR_DEVICELIST)
	NAME=$(awk -F'[][]' '{if ($2) {print $2} else {print $0}}' <<< $NAME)
	
	if [ -f $CARD/power_dpm_force_performance_level ]; then
		if echo $DPM_LEVELS | grep -q -w $1 2>/dev/null; then
			echo Setting $NAME Performance Level to $1
			echo $1 | $SUDO tee $CARD/power_dpm_force_performance_level &>/dev/null
		fi 
		MODE=$(cat $CARD/power_dpm_force_performance_level)
		DPM_LEVEL=$(echo $DPM_LEVELS | sed -e "s:$(cat $CARD/power_dpm_force_performance_level):$(cat $CARD/power_dpm_force_performance_level) <---:g")
		echo "$NAME: 
	Core Clock: $(($(cat $CARD/hwmon/*/freq1_input) / 1000000))Mhz
	VRAM Usage: $(($(cat $CARD/mem_info_gtt_used) / 1000000))MB/$(($(cat $CARD/mem_info_gtt_total) / 1000000))MB
	Memory Clock: $(awk '/*/{print$2}' $CARD/pp_dpm_mclk)
	Temperature: $(cut -b -2 $CARD/hwmon/*/temp1_input)°C
	Load: $(cat $CARD/gpu_busy_percent)%
	Power Draw: $(($(cat $CARD/hwmon/hwmon*/power1_input) / 1000000))W
	Performance Level:
			$(echo $DPM_LEVEL | sed 's:;:\n\t\t\t:g')
"
		if [ "$MODE" == "manual" ]; then
			CARDNUM=$(echo $CARD | cut -b 20)
			$SUDO cat /sys/kernel/debug/dri/$CARDNUM/amdgpu_pm_info | head -9 | sed 's:^:\t:g'
		fi
			notify-send "$NAME Performance Level:" "$MODE"
	else
		echo "$NAME: Not Compatible
		"
	fi
done

Seems to be returning the same error:

cat: '/sys/class/drm/card1/device/hwmon/hwmon*/power1_input': No such file or directory
/Scripts/amdgpu_performance.sh: line 42: / 1000000: syntax error: operand expected (error token is "/ 1000000")

Pretty confident I copied the code correctly into the script as well…

Went to look in the folder itself and the output is correct, there is not a single file/folder named power1_input in the hwmon2 folder.

That just means you didn’t properly replace the script. open the srcipt, copy the update I sent, select everything in the script and paste it over it, then save and try again.

I opened the script, erased everything, made sure to copy every line from the updated version (from #!/bin/bash all the way to done) pasted it into the fully emptied out script and then saved it. Ran it again just now, returns the same error. I’ll put the code I have saved now after making sure to fully swap it out here:

#!/bin/bash

#See: https://dri.freedesktop.org/docs/drm/gpu/amdgpu.html
#For overclocking see: https://wiki.archlinux.org/title/AMDGPU#Overclocking
#I opted not to add overclocking capabilities to this script, because of the potential risk of overclocking via unmaintained scripts...

PCI_IDS=$(find /usr/share -maxdepth 2 -name "pci.ids" -print -quit)

DPM_LEVELS="auto;low;high;manual;profile_standard;profile_min_sclk;profile_min_mclk;profile_peak"

#If privilege escalation is required, use sudo for terminal and pkexec for ouside of terminal.
[ $EUID -ne 0 ] && SUDO=pkexec && tty -s && SUDO=sudo



echo
for CARD in /sys/class/drm/card[0-9]/device;
do
	source $CARD/uevent # Load PCI_ID
	IFS=: PCI_ID=(${PCI_ID,,}) PCI_SUBSYS_ID=(${PCI_SUBSYS_ID,,})
	VENDOR_DEVICELIST=$(awk "/^${PCI_ID[0]}/{a=1;next}/^....  /{a=0}a" $PCI_IDS)
	NAME=$(sed -n "0,/\s*${PCI_SUBSYS_ID[0]} ${PCI_SUBSYS_ID[1]}  /s///p" <<< $VENDOR_DEVICELIST)
	[ -z $NAME ] && NAME=$(sed -n "0,/\s*${PCI_ID[1]}  /s///p" <<< $VENDOR_DEVICELIST)
	NAME=$(awk -F'[][]' '{if ($2) {print $2} else {print $0}}' <<< $NAME)

	if [ -f $CARD/power_dpm_force_performance_level ]; then
		if echo $DPM_LEVELS | grep -q -w $1 2>/dev/null; then
			echo Setting $NAME Performance Level to $1
			echo $1 | $SUDO tee $CARD/power_dpm_force_performance_level &>/dev/null
		fi
		MODE=$(cat $CARD/power_dpm_force_performance_level)
		DPM_LEVEL=$(echo $DPM_LEVELS | sed -e "s:$(cat $CARD/power_dpm_force_performance_level):$(cat $CARD/power_dpm_force_performance_level) <---:g")
		echo "$NAME:
	Core Clock: $(($(cat $CARD/hwmon/*/freq1_input) / 1000000))Mhz
	VRAM Usage: $(($(cat $CARD/mem_info_gtt_used) / 1000000))MB/$(($(cat $CARD/mem_info_gtt_total) / 1000000))MB
	Memory Clock: $(awk '/*/{print$2}' $CARD/pp_dpm_mclk)
	Temperature: $(cut -b -2 $CARD/hwmon/*/temp1_input)°C
	Load: $(cat $CARD/gpu_busy_percent)%
	Power Draw: $(($(cat $CARD/hwmon/hwmon*/power1_input) / 1000000))W
	Performance Level:
			$(echo $DPM_LEVEL | sed 's:;:\n\t\t\t:g')
"
		if [ "$MODE" == "manual" ]; then
			CARDNUM=$(echo $CARD | cut -b 20)
			$SUDO cat /sys/kernel/debug/dri/$CARDNUM/amdgpu_pm_info | head -9 | sed 's:^:\t:g'
		fi
			notify-send "$NAME Performance Level:" "$MODE"
	else
		echo "$NAME: Not Compatible
		"
	fi
done

Did anything get copied incorrectly? I feel very confident that I took the script code correctly.

That looks correct. but it should not be getting you that error, I fixed the part that would’ve caused it, I had accidentally hardcoded card1 as the card t oget data from, in my fixed version I undid that so it searches for the data for the appropriate card.

What the script does is it finds all your gpus, looks for ones that are using the amdgpu driver by checking if the file /sys/class/drm/card[0-9]/device/power_dpm_force_performance_level exists for that card (to confirm it is using the amdgpu driver)

Then listing information by checking that gpus amdgpu driver files.

If you do ls /sys/class/drm/card1/device/hwmon/hwmon*/

ls /sys/class/drm/card1/device/hwmon/hwmon*/

what does it show you?

And if you run this version of the script that only reports powerdraw if that file is actually found, does it work?

#!/bin/bash

#See: https://dri.freedesktop.org/docs/drm/gpu/amdgpu.html
#For overclocking see: https://wiki.archlinux.org/title/AMDGPU#Overclocking
#I opted not to add overclocking capabilities to this script, because of the potential risk of overclocking via unmaintained scripts...

PCI_IDS=$(find /usr/share -maxdepth 2 -name "pci.ids" -print -quit)

DPM_LEVELS="auto;low;high;manual;profile_standard;profile_min_sclk;profile_min_mclk;profile_peak"

#If privilege escalation is required, use sudo for terminal and pkexec for ouside of terminal.
[ $EUID -ne 0 ] && SUDO=pkexec && tty -s && SUDO=sudo



echo
for CARD in /sys/class/drm/card[0-9]/device;
do
	source $CARD/uevent # Load PCI_ID
	IFS=: PCI_ID=(${PCI_ID,,}) PCI_SUBSYS_ID=(${PCI_SUBSYS_ID,,})
	VENDOR_DEVICELIST=$(awk "/^${PCI_ID[0]}/{a=1;next}/^....  /{a=0}a" $PCI_IDS)
	NAME=$(sed -n "0,/\s*${PCI_SUBSYS_ID[0]} ${PCI_SUBSYS_ID[1]}  /s///p" <<< $VENDOR_DEVICELIST)
	[ -z $NAME ] && NAME=$(sed -n "0,/\s*${PCI_ID[1]}  /s///p" <<< $VENDOR_DEVICELIST)
	NAME=$(awk -F'[][]' '{if ($2) {print $2} else {print $0}}' <<< $NAME)
	
	if [ -f $CARD/power_dpm_force_performance_level ]; then
		if echo $DPM_LEVELS | grep -q -w $1 2>/dev/null; then
			echo Setting $NAME Performance Level to $1
			echo $1 | $SUDO tee $CARD/power_dpm_force_performance_level &>/dev/null
		fi 
		MODE=$(cat $CARD/power_dpm_force_performance_level)
		DPM_LEVEL=$(echo $DPM_LEVELS | sed -e "s:$(cat $CARD/power_dpm_force_performance_level):$(cat $CARD/power_dpm_force_performance_level) <---:g")
		[ -f $CARD/hwmon/hwmon*/power1_input ] && POWER=$(($(cat $CARD/hwmon/hwmon*/power1_input) / 1000000))
		echo "$NAME: 
	Core Clock: $(($(cat $CARD/hwmon/*/freq1_input) / 1000000))Mhz
	VRAM Usage: $(($(cat $CARD/mem_info_gtt_used) / 1000000))MB/$(($(cat $CARD/mem_info_gtt_total) / 1000000))MB
	Memory Clock: $(awk '/*/{print$2}' $CARD/pp_dpm_mclk)
	Temperature: $(cut -b -2 $CARD/hwmon/*/temp1_input)°C
	Load: $(cat $CARD/gpu_busy_percent)%
	Power Draw: ${POWER}W
	Performance Level:
			$(echo $DPM_LEVEL | sed 's:;:\n\t\t\t:g')
"
		if [ "$MODE" == "manual" ]; then
			CARDNUM=$(echo $CARD | cut -b 20)
			$SUDO cat /sys/kernel/debug/dri/$CARDNUM/amdgpu_pm_info | head -9 | sed 's:^:\t:g'
		fi
			notify-send "$NAME Performance Level:" "$MODE"
	else
		echo "$NAME: Not Compatible
		"
	fi
done
ls /sys/class/drm/card1/device/hwmon/hwmon*/

returns:

device       fan1_min     freq2_input  name            power1_cap_default  pwm1         subsystem        temp1_input      temp2_emergency  temp3_crit_hyst  uevent
fan1_enable  fan1_target  freq2_label  power           power1_cap_max      pwm1_enable  temp1_crit       temp1_label      temp2_input      temp3_emergency
fan1_input   freq1_input  in0_input    power1_average  power1_cap_min      pwm1_max     temp1_crit_hyst  temp2_crit       temp2_label      temp3_input
fan1_max     freq1_label  in0_label    power1_cap      power1_label        pwm1_min     temp1_emergency  temp2_crit_hyst  temp3_crit       temp3_label

The power draw script runs just fine and returns:

Radeon RX 6800/6800 XT / 6900 XT:
        Core Clock: 36Mhz
        VRAM Usage: 181MB/25211MB
        Memory Clock: 1000Mhz
        Temperature: 42°C
        Load: 1%
        Power Draw: W
        Performance Level:
                        auto <---
                        low
                        high
                        manual
                        profile_standard
                        profile_min_sclk
                        profile_min_mclk
                        profile_peak

yeah there we go. Your core clock is awfully low, 36mhz :thinking:

If you set the performance level to high (./amdgpu_performance.sh high) will do that for you.

echo high | sudo tee /sys/class/drm/card1/device/power_dpm_force_performance_level &>/dev/null

would also do it (that’s what my script will do).

Does it perform better?

Also is that vram total accurate? I don’t know what exact gpu you have but it probably doesn’t have 26GB VRAM does it? :thinking: (this is probably my mistake, I designed that part to work with igpus, the total vram for them is roughly half of the total ram… do you have 52GB RAM? That’s a strange number and it’s possibly related to the issue, it would mean yo uhave an unusual ram configuration which can cause all kinds of issues)

Not sure why it displays VRAM as ~25GB, the GPU (6900XT Sapphire Nitro) has 16GB VRAM and my RAM is 48GB. The amdgpu_performance script still didn’t work even with the high argument, used the other command you sent and that properly set it to high performance mode. Powerdraw script then returned the clock at ~200Mhz, so I’ll try if I actually got any performance increases from that.

I think the low core clock might just have been an low demand moment as running the command now gives results in the 83-200 range (mostly idling, not running anything performance intensive).

After a little testing, there might be small performance gains, but it did not seem major (did one mission in helldivers and walked around busy areas in monster hunter wilds). Core clock levels went close to 2k Mhz during playing when set to high performance level on the gpu. Did have a full hard crash to blue screen with “Kernel panic” as the ‘reason’ (showed an ascii penguin and a QR code that I didn’t scan in time before the PC rebooted itself). Unsure if related or not, but I have not had that happen ever before. Right after adding the last edit my PC full crashed and reset again, no blue screen this time. I think I’ll avoid setting it to high performance mode for now.

25gb is a bit more than half of 48gb so it’s probably just that, it’s a fault with my code don’t worry about it, the vram usage is accurate but the total vram is not.

You had a legit bluescreen huh, i’ve never had an ascii penguin bluescreen myself, my last kernel panic was like half a decade ago or something.

The kernel panic might actually be related, oyu have 48gb ram? That is not a normal configuration, usually people use 8/16/32/64GB, your unusual ram configuration could be causing you problems at the hardware level.

What is your exact configuration? What is the output of inxi --admin -m ?

inxi --admin -m returns:

Memory:
  System RAM: total: 48 GiB available: 46.96 GiB used: 5.42 GiB (11.5%)
  Message: For most reliable report, use superuser + dmidecode.
  Array-1: capacity: 128 GiB slots: 4 modules: 4 EC: None
    max-module-size: 32 GiB note: est.
  Device-1: Channel-A DIMM 0 type: DDR4 detail: synchronous unbuffered
    (unregistered) size: 8 GiB speed: 2133 MT/s volts: note: check curr: 1
    min: 1 max: 1 width (bits): data: 64 total: 64 manufacturer: G.Skill
    part-no: F4-3200C16-8GTZRX serial: N/A
  Device-2: Channel-A DIMM 1 type: DDR4 detail: synchronous unbuffered
    (unregistered) size: 16 GiB speed: 2133 MT/s volts: note: check curr: 1
    min: 1 max: 1 width (bits): data: 64 total: 64 manufacturer: G.Skill
    part-no: F4-3200C16-16GIS serial: N/A
  Device-3: Channel-B DIMM 0 type: DDR4 detail: synchronous unbuffered
    (unregistered) size: 8 GiB speed: 2133 MT/s volts: note: check curr: 1
    min: 1 max: 1 width (bits): data: 64 total: 64 manufacturer: G.Skill
    part-no: F4-3200C16-8GTZRX serial: N/A
  Device-4: Channel-B DIMM 1 type: DDR4 detail: synchronous unbuffered
    (unregistered) size: 16 GiB speed: 2133 MT/s volts: note: check curr: 1
    min: 1 max: 1 width (bits): data: 64 total: 64 manufacturer: G.Skill
    part-no: F4-3200C16-16GIS serial: N/A

I have this amount cuz I only had 16GB at some point but when I upgraded my components through a relative he gifted me the two 16GB rams along with the GPU. He is pretty well versed in pc building and computer stuff in general (he built my current setup initially, I have only upgraded it bit by bit) so I assumed he knew what would have problems and what wouldn’t.

It’s not like this kind of setup is guaranteed to have problems, in fact, it shouldn’t. Your relative has picked extremely well, ram with the same speed (although you’re running it at 2133Mhz when it should run at 3200), same timing, even the same manufacturer just to be sure, your relative definitely did everything right here, if I wanted to couple 16GB ram with that 8gb set you have this is the best case scenario I would have picked too.

I was mostly concerned you might have ram that wasn’t likely to play well together :thinking: but you don’t have that problem. still though it might be worth trying to remove the 8gb set, see if that helps with the performance, and if it doesn’t, then try removing the 16gb set instead and see if that does.

Even if all this ram should work well together sometimes faulty ram happens, and it can be quite insidious. You could run a memtest to check how stable your ram configuration is, but that takes an extremely long time to do which is why i suggest removing sticks to see if any of them are causing the problem; it’s a lot faser to check that way.

You might also want to see if there’s a bios update for your motherboard, sometimes they can solve problems like these.

I just had another blue screen and managed to quickly take a picture of it before the reset timer automatically reset the PC. Interestingly I was not on the high performance mode, kept the GPU mode as auto like always. The bluescreen text reads:

KERNEL PANIC!
Please reboot your computer.
Fatal local machine check

I’ll try scan the QR code that was on the screen as well but my phone scanner is not entirely co-operating with me since I took the picture at an angle. I’ll check for BIOS updates first and if that comes up dry I suppose I’ll start trying RAM removals.

Wonder whose idea it was to put a QR code in there that you don’t get enough time to take a picture of :thinking:

Kernel panics like this, especially so frequent tend to point towards hardware issues, it’s not absolute though, I have had kernel panics while gaming before but those were always nvidia related.

Bios update did not go through as my pc doesn’t want to properly read that my newly formatted USB drive is in the FAT32 format and has the update file on it(as is instructed on my motherboard manufacturer’s website). Also managed to get the kernel panic blue screen a few more times now, and once at least I got the QR code scanned which gave me 11154238 as a result of the scan. I suppose I’ll try the ram removal and just see what happens.

If your bios couldn’t read a fat32 usb your motherboard might be damaged and causing all these problems, are you sure it couldn’t read the usb? Those bios uefi interfaces can be a bit clunky to navigate after all.

I am fairly certain I navigated the bios interface correctly and according to the bios update guide from the manufacturer.

Also, I have had a few more crashes of the entire PC again, some of them bluescreens and some of them just straight up cut to black and then instant restart. From the last of that type of crash I saw something about a CPU error code during the bootup code that runs across the screen really fast. It was way too fast to read anything specific so I tried to find something like a log of the boot-up and found this at least:
On every line before kernel it just had the datre/time and my PC name on it.

kernel: [Hardware Error]: System Fatal error.
kernel: fbcon: Taking over console
kernel: [Hardware Error]: CPU:0 (19:21:2) MC27_STATUS[Over|UE|MiscV|-|PCC|SyndV|-|-|-]: 0xfaa000000000080b
kernel: [Hardware Error]: IPID: 0x0001002e00000500, Syndrome: 0x000000005d000000
kernel: 
kernel: [Hardware Error]: Power, Interrupts, etc. Ext. Error Code: 0
kernel: [Hardware Error]: cache level: L3/GEN, mem/io: IO, mem-tx: GEN, part-proc: SRC (no timeout)

Could this help pinpoint some kind of particular problem?
Also at this point the thread is kind of going outside of the title’s scope so should I mark it as solved but keep trying to resolve it here or should I open up a new thread with a more accurate title?

I looked up the MC27_STATUS message, it seems to point towarsd a memory problem. Did you try the ram removal?

Tried the RAM removal, removing the older 8GB sticks did not yield any performance gains.
Did not have any crashes of any kind yesterday even with both ram sticks still installed, so it might have been a short term issue from system updates? (checked for updates frequently after the crashes started and now the crashing has not happened in 2 days)

I think it might just boil down to my graphics card having some kind of issue. Everything I look up says that my GPU should be more than enough to pull a stable 60fps if not more in the games that I play and yet that just is not the case. Could be due to me usually buying GPUs second-hand to save a bit of money but that could be doing more harm than good in the long run.

Yes it’s very strange. Have you utilized mangohud to see things like cpu and gpu utilization while you’re gaming? It’ll at least hint to you where the problem is.

Not mangohud but CoreCtrl, although I do remember reading that it recently was discarded so I should try to look into something new I suppose. Not very good at reading hardware performance problems from just the values generally - so the only issue I could identify was that the GPU memory clock is locked to 1000MHz but that seems to be a fairly common issue on both windows and Linux with AMD cards on high refresh rates and resolutions. (also apparently it does not affect performance, just makes some parts of the GPU run at 100% all the time for some reason - at least that is what I managed to piece together from various forum threads about it)

Utilization on both seemed to be going to 100% during heavy loads as well so it looked okay to me.

Also, had another PC crash to restart again, just a few minutes ago after I had reinserted the 2 8GB ram sticks and been using the PC for about 3h, so perhaps they were causing some of the problems after all… I’ll remove them for longer than just a few hours and see if the problem reoccurs.
Update: Still had a PC crash after removing the 8GB ram sticks, so they were not the issue I suppose.