crystalidea / macs-fan-control

Control fans on Apple computers
https://crystalidea.com/macs-fan-control
905 stars 102 forks source link

Adding Radeon GPU Temperatures #608

Open startergo opened 2 years ago

startergo commented 2 years ago

Maybe you can incorporate these sensors: https://github.com/aluveitie/RadeonSensor

[2022-05-26 18:14:15:444] [thread 8670] [TempSensorProvider.cpp#68] TemperatureSensorProvider::loadAvailableSensors
[2022-05-26 18:14:15:445] [thread 8670] [Service.cpp#62] getSMCKeysCount: 2046820352 122
[2022-05-26 18:14:15:446] [thread 8670] [Service.cpp#564] Locating temperature SMC keys
[2022-05-26 18:14:15:446] [thread 8670] [Service.cpp#579] Ignore binary search
[2022-05-26 18:14:15:456] [thread 8670] [Service.cpp#610] 39 keys found
[2022-05-26 18:14:15:457] [thread 8670] [Provider_mac.mm#268] discoverGPUs started
[2022-05-26 18:14:15:468] [thread 8670] [Provider_mac.mm#351] addGPU AMD Radeon RX 6900 XT with MTLDevice
[2022-05-26 18:14:15:468] [thread 8670] [Provider_mac.mm#22] Device hold AMD Radeon RX 6900 XT
[2022-05-26 18:14:15:471] [thread 8670] [Provider_mac.mm#351] addGPU AMD Radeon PRO W6600 with MTLDevice
[2022-05-26 18:14:15:471] [thread 8670] [Provider_mac.mm#22] Device hold AMD Radeon PRO W6600
[2022-05-26 18:14:15:471] [thread 8670] [Provider_mac_watcher.mm#82] eGPUWatcher started
[2022-05-26 18:14:15:471] [thread 8670] [TempSensorGPU.cpp#92] Discrete GPU: GPU AMD Radeon RX 6900 XT, matching SMC - yes
[2022-05-26 18:14:15:471] [thread 8670] [TempSensorGPU.cpp#92] Discrete GPU: GPU AMD Radeon PRO W6600, matching SMC - yes

[2022-05-26 18:14:15:497] [thread 8670] [TempSensorProvider.cpp#132] InitialLoadThread: number of supported GPU sensors: 2

image

kleuter commented 2 years ago

I don't mind, any chance for a sample code how to query those GPU list and T values? I don't own a hackintosh.

startergo commented 2 years ago

All you need is 2 Kexts. One of them is installed inside the other one. So install this kext in /L/E and see if you can read the temperatures of AMD GPU on a real Mac in MFC. SIP probably has to be disabled as the kexts are not signed. image VirtualSMC.kext.zip

The source code for the RadeonSensorSMC.kext is in my first post. https://github.com/Andrej-Antipov/Kext-Install-Utility/blob/master/KextLEinstaller.zip

kleuter commented 2 years ago

Related: https://www.apriorit.com/dev-blog/430-macos-kext-development

kleuter commented 2 years ago

Some thoughts about this possible feature.

This is obviosly limited to

A custom kext is an issue here - special code signing from Apple is required.

Still not sure if it would be worth efforts.

elasim commented 2 years ago

FYI. It's reporting egpu temp without any custom kext. I don't know when it happened exactly from. but I checked this today after update to ventura.

shot
startergo commented 2 years ago

Ventura shows it. But not earlier macOS.

kleuter commented 2 years ago

Could you please run this command and post the output?

ioreg -l | grep '"PerformanceStatistics"' | sed -E "s/,/\\n/g;s/\"//g" | grep -E "(temp|power|Device Utilization|Fan|speed|GPU Activity)"
elasim commented 2 years ago
❯ ioreg -l | grep '"PerformanceStatistics"' | sed -E "s/,/\\n/g;s/\"//g" | grep -E "(temp|power|Device Utilization|Fan|speed|GPU Activity)"
Device Utilization %=4
Fan Speed(%)=0
GPU Activity(%)=0
Fan Speed(RPM)=0
Device Utilization %=0
Fan Speed(%)=0
GPU Activity(%)=0
Fan Speed(RPM)=0
GPU Activity(%)=22
Fan Speed(%)=20
Device Utilization %=8
Fan Speed(RPM)=689
GPU Activity(%)=23
Fan Speed(%)=20
Device Utilization %=1
Fan Speed(RPM)=689
Device Utilization % at cur p-state=22
Device Utilization %=6
startergo commented 1 year ago
ioreg -l | grep '"PerformanceStatistics"' | sed -E "s/,/\\n/g;s/\"//g" | grep -E "(temp|power|Device Utilization|Fan|speed|GPU Activity)"
Device Utilization %=0
Fan Speed(%)=25
GPU Activity(%)=0
Fan Speed(RPM)=1443
Device Utilization %=0
Fan Speed(%)=25
GPU Activity(%)=0
Fan Speed(RPM)=1443
GPU Activity(%)=0
Fan Speed(%)=24
Device Utilization %=0
Fan Speed(RPM)=1200
GPU Activity(%)=0
Fan Speed(%)=24
Device Utilization %=0
Fan Speed(RPM)=1200
x299@x299s-iMac-Pro ~ % 

Radeon temperature shows now. At least on hackintosh in Ventura: image

Edit: Added statistics for troubleshooting

iMacPro1,1_tech_info.zip

kleuter commented 1 year ago

I can confirm it's working in Ventura