Contribute
Register

[GUIDE] Injection of AMD Vega Power and Fan Control Properties

Vega code was first spotted in Sierra 12.5-12.6 but no cards were available to us for testing. When High Sierra beta 10.13.0 came out it included the AMD10000Controllerkext and AMDRadeon5000kexts exclusively for Vega.

@Gigamaxx,

Many thanks for the clarification ... i think what i was really trying to say is that that Vega GPU support was not stable until 10.13.4 and as you say things have got better since then.

I've only had my Sapphire Vega 64 Liquid Cooled GPU for a couple of months but am very impressed with its abilities, especially when rendering videos in FCPX, it's over twice as quick than the GTX 980Ti OC/Liquid Cooled GPU which it replaced and is of course fully supported in Mojave.

Next Stop! Navi. AMD6000HWServiceskext now in Mojave! Can’t wait to get a Navi card for testing!

Yes, i'm keeping a close eye on AMD and Navi, it will be very interesting to see what they do with the architecture and how well it compares to Nvidia RTX ... word is that it will be affordable as AMD are going to use DDR5+ or DDR6 VRAM rather than the super expensive HBM Memory they used on Vega.

Interesting times ahead ....

Cheers
Jay
 
Last edited:
@jaymonkey

I put together a small python script to handle the merging of the VGTab Info.plist's aty_properties into the config.plist's Devices -> Properties. Feel free to use it if you find it helpful. If not, no worries!

The script can be found here: https://github.com/corpnewt/VGTabMerge

Happy hacking,

-CorpNewt
 
View attachment 374336

Injection of Device Properties for Power and Fan control
Last updated 2nd January 2019

Although the AMD Vega 56 and 64 GPU's are natively supported by MacOS 10.13.6 and 10.14.X they can sometimes need a little tweaking in order to get them running at their full potential on a hackingtosh system.

In most instances installing Lilu + WhatEverGreen (WEG) into /L/E will ensure that the Vega has the correct GFX0 ACPI identity and resolve most of the known issues such as the black screen on boot:-

https://www.tonymacx86.com/threads/an-idiots-guide-to-lilu-and-its-plug-ins.260063/

However many users have reported strange fan and GPU temperature behaviours when the Vega is put under load even with Lilu + WhatEverGrenn installed. One of most common issues reported is when the Vega is put under load the temps will start to rise but the Fan and/or Pump speed will decrease. Another common issue reported is that the fan is running at full speed at all times until a video in youtube is played.

The solution to these issues is to inject a custom SoftPowerPlayTable which defines fan speed set points, memory & die clock frequency's and voltages. As has been reported in other posts we can use the VGTab utility to define either a stock or custom SoftPowerPlayTable by means of a simple and easy to use GUI:-

The VGTab Utility exports the defined SoftPowerPlayTable as a raw hex file (Filename = VGTab_XXXX_data.kext) and as a simple injector kext (Filename = VGTab_XXXX.kext), the VGTab injector Kext essentially has two phases ....

First it configures the Vega Frame Buffer (FB) by using a Vega model specific FB name and some VID/PID matching.

However if you are already using WhatEverGreen (WEG) to configure your IGPU (possibly as headless) then WEG will also take care of configuring the Vega Frame Buffer by injecting a universal/generic Frame Buffer that should work for all Vega's as well as injecting some (but not all) Vega Device Properties.

By having both WEG and the VGTab kext configuring the Vega Frame Buffer using different methods results in a configuration conflict which can result in WEG and/or the VGTab kexts exiting abnormally.
_____________________________________________________​

Some users have worked around this conflict by directly modifying the info.plist embedded in Apple's AMD10000Controller kext, but the use of static patched systems kexts means that SIP must be disabled and the patch must be re-applied after each MacOS update so its not a great solution.

Other users have found that "injecting" the VGTab kext via Clover (/EFI/Clover/Kexts/Other) can help WEG and the VGTab kext to co-exist, but injected kexts live outside of the MacOS protected memory space and are not cached and can make for an unstable system, by forcing both kexts to be injected results in an improperly configured system as the conflict is still occurring.

Note: If you are not using WhatEverGreen then its unlikely you will suffer from this conflict and can just use the VGTab Kext as is, however if you have a desktop class CPU with an integrated IGPU and are using a iMac or Mini Mac SMBIOS then you should consider using WhatEverGreen to configure the IGPU with a headless PlatformID which is how genuine iMac's and Mini Mac's with dual GPU's are configured. If you are un-familiar with headless PlatformID's then see the Lilu and Plug-in's guide for more information which has a dedicated section on the subject.

_____________________________________________________
During its second phase the VGTab kext configures some additional Device Properties for the Vega's power and fan control and lastly injects the SoftPowerPlayTable defined in the VGTab GUI, if a conflict occurs between WEG and VGTab then in many cases the SoftPowerPlayTable will not get injected.

Since WEG already takes care of setting up the Vega's frame buffer (and configuring the IGPU) we can leave that task to it and inject the Vega's power and fan control parameters and the SoftPowerPlayTable as Device Properties using Clover rather than using the VGTab kext thus avoiding any conflicts or the need to directly modify the AMD10000Controller kext.

_____________________________________________________​
Method

1. Run the VGtab utility and select the type of Vega card you have, in most instances you can just accept the stock/default values or use the GUI to modify the values as you wish, once your done click on the Generate Control Information button and accept the notification to allow VGTab to save the generated files/data onto your MacOS desktop.

2. Mount your EFI partition and make a backup of your config.plist just in case something goes wrong.

3. Open your active config.plist with a code or text editor and move down the file until you find the "Devices" section, and then move down to the "Properties" sub section.

4. Highlight all of the following code and Copy/Paste it into your config.plst after the <dict> (below the Properties key) to create a new Key for the PCI path of the Vega GPU:

Code:
            <key>PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)</key>
            <dict>

            </dict>

The result should look something like this ....

View attachment 373691
Although i'm sure that the PCI device path for the Vega GUP will be the same for all users you can check that it is correct for your system by using GFXUTIL (attached to this post). Unzip the archive and open Terminal, change the current path (CD) to the folder you extracted GFXUTIL in and execute the following command:
Code:
./gfxutil -f GFX0

GFXUTIL should return with the device path of your Vega GPU :-
Code:
MonkeyMac-Pro-2018:~ Jay$ cd /Users/Jay/Downloads/gfxutil-1.76b
MonkeyMac-Pro-2018:gfxutil-1.76b Jay$ ./gfxutil -f GFX0
DevicePath = PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)
MonkeyMac-Pro-2018:gfxutil-1.76b Jay$

Note: If you get an error such as "GFX0 device not found" or "unsupported registry entry" then your Vega GPU most likely does not have the GFX0 ACPI identity which is critical for correct operation, installing Lilu + WhatEverGreen (which is recommended) will correct this issue for you (see this guide for more info), alternatively you could use a Clover rename ACPI fix or use a SSDT Hot Patch.

If the PCI Device Path for your Vega is different to the key value in the code you inserted in Step 4 then simply copy the PCI Device Path from the terminal output of GFXUTIL and paste it into your config.plist, over-writing the value from the example code above.

5. Now right click on the VGTab_XXXX.kext on the desktop and select Show Package Contents, expand the Contents folder and open the info.plist with your code or text editor, move all the way to the bottom of the file where you see the key "aty_properties" that includes a large 'data' value for the property PP_PhmSoftPowerPlayTable.

6. Highlight all the code between <dict> and </dict> (below the "aty_properties" key) as shown below :-

View attachment 373694
7. Copy/Paste the high-lighted code into your config.plist between the <dict> and </dict> below the new key value you created in Step 4, the result should look something like this :-

View attachment 373695
8. Check your work carefully, ensure that you keep the code structure correct, if all looks good then save your config.plist.

9. A quick and easy way to check that there are no syntax errors in your config.plist is to open it with Clover Configurator, Click on the Devices section, then on Properties on the lower tab bar, select the new PCI key you created in Step 4, you should see all of the property values that you inserted in Step 7, you can also use Xcode or PlistEdit Pro to check that the edits are correct:-

View attachment 373696 View attachment 373697
If you get a formatting or syntax error then you've made a mistake, recheck you code, if in doubt start again from Step 1.

10. If everything looks ok then your good to go, if you have previously installed the VGTab kext in /L/E or /EFI/Clover/Kexts/Other then remove it and rebuild the kext caches if necessary ( I use Kext Utility).

11. Finally reboot.

Note: If after testing you find you need to make more adjustments to the Vega settings then you can simply re-run the VGTab utility, make the adjustments and/or changes and re-export the data/kext. This time you'll only need to copy/paste the large 'data' value for the property PP_PhmSoftPowerPlayTable as all other property values will be unchanged.

_____________________________________________________​
Results

You should now find that your Vega's thermal cooling is working as expected in that the Fan/Pump speed will increases as the Vega's GPU die temp ramps up when under load, once it reaches the target temp set with the VGTab it should maintain that temperature until the GPU load is removed at which point the Fan/Pump speed will decreases as the die temp ramps down until it returns to the idle state.

By injecting the Device Properties for the Vega using Clover we can avoid having to use the VGTab kext and there is no need for any manual edits to the Native Apple Vega kext (AMD10000Controller.kext) meaning you can update MacOS and not have to worry about any static kext edits.

I have attached a stripped out config.plist as an example with the above code from Step 4 already in place:

View attachment 373710
I've also attached the VGTab Utility for those users who do already have it.

_____________________________________________________​

Monitoring of Vega GPU Sensors

The best solution i have found (so far) for monitoring of the Vega GPU is to use HWMonitorSMC2 which is a fork of HWSensors3 by blusseau, kozlek & slice2009
View attachment 373709
Installation is fairly straight forward but you should first remove any old version(s) of HWMonitor, FakeSMC and its associated sensor plugins. Then download the latest dmg of HWSensors3 from this SourceForge page, unzip the dmg you downloaded and open it.

There are two versions of the Monitoring App in the dmg, the one you want is called HWMonitorSMC2, copy this from the dmg to your Applications folder.

Next Install the included FakeSMC.kext and IntelCPUMonitor.kext from the folder called "Extensions" into /L/E and also update the copy of FakeSMC in /EFI/Clover/Kexts/Other.

Finally you also need to install a plugin for monitoring your motherboard sensors. My Z97 system uses a Winboard chip so I installed the W836x.kext. See the Readme pdf file in the "Extensions" folder of the dmg for descriptions of the other plugins.

Note: Do not Install the RadeonMonitor kext as it does not support Vega GPU's, it's only for legacy AMD GPU's.

Once you have everything installed, reboot and run the HWMonitorSMC2 application .... you should see a new icon in your top menu (Square with a Waveform in it), click on it and you should see some basic sensor values.

There is currently a bug in the App that stops us getting to the settings on the first run so click on the 'X' to quit the App then run it again, click on the icon in the top menu again and then on the cog icon at the bottom of the monitoring window.

On the settings screen enable the option "Use the IOAccelerator's monitoring for GPUs", and enable/disable any other options as you wish, this is how i configure it on my system :-

View attachment 373672
With these settings you should now be able to monitor your Vega GPU in real time, you can move the monitoring window to another monitor if you need to keep it open while running benchmarks .. etc.

View attachment 373708

Vega Total Power Sensor

By default the VGTab injector kext sets the Device Property PP_DisablePowerContainment to 1 (true) to allow a custom SoftPowerPlayTable to overclock the Vega and thus draw more power. Unfortunately this also appears to disable the Total Power (in Watts) data point sensor meaning that it will always display 0 Watts in the HWMonitorSMC2 App.

If you are not applying an overclock to your Vega you can set this Property to 0 (false) which will re-enable the Total Power data point sensor, you can use a standard editor, XCode, PlistEdit Pro or Clover Configurator to edit this value:-

View attachment 373790
With PP_DisablePowerContainment set to 0 (false) you should now see how much power (in Watts) your Vega GPU is using, however you should be aware that the Vega fan, temp and power stats are coming from MacOS not directly from the Vega.

From my testing in Mojave 10.14.2 there appears to be an issue with the Total Power reading when the Vega is being used for Open CL/GL such as a benchmark (FurMark,Valley, Heaven ... etc) in that the larger the rendered output window the higher the power reading .. which is not correct as the size of the rendered output should not effect the Total Power the Vega is drawing from your PSU. If i run one of those benchmarks at full screen on my 21:9 monitor (3440x1440) the Total Power stat displays 680W which is clearly incorrect.

This issue can be confirmed by executing the following terminal command while running a benchmark full screen:-
Code:
ioreg -l |grep \"PerformanceStatistics\" | cut -d '{' -f 2 | tr '|' ',' | tr -d '}' | tr ',' '\n'|grep 'Temp\|Fan\|Power'
Which shows that the Total Power stat is incorrect as computed by MacOS :-
Code:
MonkeyMac-Pro-2018:~ Jay$ ioreg -l |grep \"PerformanceStatistics\" | cut -d '{' -f 2 | tr '|' ',' | tr -d '}' | tr ',' '\n'|grep 'Temp\|Fan\|Power'
"Fan Speed(%)"=45
"Fan Speed(RPM)"=1501
"Temperature(C)"=33
"Total Power(W)"=683
MonkeyMac-Pro-2018:~ Jay$
Hopefully this issue/error it will be fixed by Apple in the next MacOS release.

Unfortunately HWMonitorSMC2 currently has no graphing abilities and in an ideal world it would access the Vega's diagnostic and monitoring sensors directly rather than using the MacOS IOAccelerator Module. Hopefully these features will be added to it in the future ... alternatively it is possible that the standard fork of HWMonitor will eventually get full support for Vega GPU's (@RehabMans fork of @Kozlekek HWSensors only supports Vega GPU die temp).
_____________________________________________________​

I hope this method of injecting the Vega power and fan properties helps anyone having issues when using the VGTab kext as well as WhatEverGreen or simply want to resolve the Vega fan/temps issue without having to use the VGTab kext.

Note: This is currently an experimental method, but as it essentially does the same as the VGTab kext it should work for most people as long as you do not make any mistakes with the config.plist edits. It worked for me so i'm posting it here so that others can try it. Please post any success or failures below so we can further understand its effect.

Cheers
Jay

Hi,

After clicking on the Generate Control Information button and accepted the notification. I still can't see the data file...

Can help?
 
I put together a small python script to handle the merging of the VGTab Info.plist's aty_properties into the config.plist's Devices -> Properties. Feel free to use it if you find it helpful.

@corporatenewt,

Nice job, the script could be useful for beginners that are not familiar with working with a raw config.plist.

I'll put a link to your script in the guide (with credit) but before I do could i ask you to expand the readme.md with more clear instructions on how to use it along with an example ....

Cheers
Jay
 
Last edited:
Hi, After clicking on the Generate Control Information button and accepted the notification. I still can't see the data file...

@kingkong89,

Yes i've seen this issue myself, but i don't know why it does it. Its possible that its some sort of rights or permissions issue. The way i worked around it was to copy the VGTab utility to my Documents folder and run it from there, if that does not work try renaming it ...

Cheers
Jay
 
@jaymonkey

I updated the ReadMe, should be clearer now - but let me know if you think anything else is missing.

Happy Hacking,

-CorpNewt
 
@kingkong89,

Yes i've seen this issue myself, but i don't know why it does it. Its possible that its some sort of rights or permissions issue. The way i worked around it was to copy the VGTab utility to my Documents folder and run it from there, if that does not work try renaming it ...

Cheers
Jay

Given that description it's probably related to the 'app translocation' security feature. The VGTab 'web page' eventually calls the actual VGTab app again, and if it translocated I'm not entirely sure the URL schemes it registers are actually honored in that case.

Translocation causes an app to be copied to a random read-only file path and executed from there. It happens if you download an app and run it from where you downloaded it. You have to move it (with finder) to another folder and that will clear the 'translocation' flag. You can move it back to the original folder it was in and it will work fine. The important thing is you move it at least once.
 
Given that description it's probably related to the 'app translocation' security feature. The VGTab 'web page' eventually calls the actual VGTab app again, and if it translocated I'm not entirely sure the URL schemes it registers are actually honored in that case.

Translocation causes an app to be copied to a random read-only file path and executed from there. It happens if you download an app and run it from where you downloaded it. You have to move it (with finder) to another folder and that will clear the 'translocation' flag. You can move it back to the original folder it was in and it will work fine. The important thing is you move it at least once.

Thanks jaymonkey and zakklol but it didn't work...
 
@jaymonkey

I updated the ReadMe, should be clearer now - but let me know if you think anything else is missing.

Happy Hacking,

-CorpNewt

It worked now. What happen was I had multiple copies of the app, in the download folder, Document folder and desktop. I deleted all and empty the trash bin. Then I download the app again, and MOVE it to the desktop. It worked from there.
 
At the risk of sounding like the noob I really am:
The Nitro+ VEGA cards have dual bios - one for quiet and one for power operation. Could the varying fan speed experiences of different people, to some extent, be explained by this? How do you know which bios your VEGA card is currently using? And how do you change it on a Hackintosh?
 
Back
Top