Skip to content

Latest commit

 

History

History
150 lines (122 loc) · 10.7 KB

Polaris_PowerPlay_Tables.md

File metadata and controls

150 lines (122 loc) · 10.7 KB

Creating Custom PowerPlay Tables for AMD Polaris Cards

DISCLAIMER: Use this guide on your own risk! Playing around with the parameters of your vBIOS can cause irreparable damage to your Graphics Card if you don't know what you are doing. Since I don't know which GPU you are using and I don't know which parameters you want to modify, I am only showing you how to change them but not which settings to use specifically. It's up to you to figure that out. You can use the example files contained in the PowerPlayInfo.zip file for reference. They contain further explanations about the structure of the PowerPlayInfo data contained in the vBIOS.

TABLE of CONTENTS

About

Guide for creating a PP_PhmSoftPowerPlayTable Device Property for Radeon Polaris cards to inject into macOS. This way you can modify things like Clock Speeds, Fan Curves and Power Limits to optimize performance while reducing power consumption at the same time which wouldn't be possible otherwise. On top of that you don't have to flash a modified BIOS on your GPU.

How it works

Basically, you dump the vBIOS ROM from your GPU, modify it, save it. Then you extract the PowerPlayInfo table from the modded ROM with a Hex Editor and inject into macOS via DeviceProperties. Combined with @0,name property to select a specific Framebuffer this is probably the best method to optimize performance and power consumption of AMD cards under macOS

Requirements

  • 500-series AMD GPU with Polaris BIOS (usually Radeon RX 570 to RX 590)
  • Windows Installation
  • Software (Windows):
    • amdvbflash → for dumping vBIOS ROM(s) from the GPU
    • ATOMBIOSReader → for generating a list of command and data tables from a vBIOS
    • PolarisBiosEditor → for editing the vBIOS ROM
    • HxD → Hex Editor for extracting data from the ROM file for the PP_PhmSoftPowerPlayTable property
  • Software (macOS)
    • Hackintool → for finding the PCI Path of your discrete GPU
    • Plist Editor (ProperTree or OpenCore Auxiliary Tools) for editing DeviceProperties
    • LuxMark (see "Binaries" section) → for OpenCL Benchmark test
    • Geekbench → for Benchmarking Metal
    • HWMonitorSMC2 → For monitoring CPU and GPU Performance, Power Consumption and Temps.
    • Intel Power Gadget → installs EnergyDriver.kext into S/L/E which can be utilized by HWMonitorSMC2 for monitoring (select "Intel Power Gadget" in options).

Instructions

Dumping the vBIOS

  1. Boot Windows
  2. Run amdvbflashWin.exe as Admin:
    ATIWinFlash
  3. Press "Save" to dump the vBIOS ROM
  4. Give it a reasonable name like "BIOS_stock" and save it.

💡 NOTE: If your GPU has a BIOS switch (the Sapphire Nitro+ RX580 has one), shutdown your Computer, change the position of the switch and repeat steps 1 to 4, so you have backups of both BIOS files.

Modifying the vBIOS

  1. Open PolarisBiosEditor
  2. Click on "Open BIOS" and open the BIOS dumped previously:
    RX580_mod
  3. Select the parameter you want to change and enter its new value
  4. Once you done editing click on "SAVE AS"
  5. Save the file as "BIOS_Mod". Don't override the original vBIOS file

💡 For suggestions on which parameters to modify, you can check out the BIOS mods presented in this thread. But don't flash the actual modified ROM(s) as suggested in that guide – this is only necessary on real Macs, not Hackintoshes! We will inject DeviceProperties instead.

Locating the PowerPlayInfo inside the modded .rom file

  1. Run ATOMBIOSReader.exe:
    AtomBIOS01
  2. Open you BIOS_Mod.rom file → this will generate a .txt file. It contains a list of all the Command Tables of the ROM ass well as the addresses they are located at in memory.
  3. Open the BIOS_Mod.rom.txt file and search for "PowerPlayInfo":
    txtfile
  4. It says 9bba Len 0341 in my case.

This means the PowerPlayInfo starts at position 9bba (hex) of the ROM and has a length of 341. So we have to copy the code starting at position 9bba for the length of 341.

Extracting PowerPlayInfo from the modded vBIOS .rom

  1. Run HxD Hex Editor
  2. Open your patched "BIOS_MOD.rom" file
  3. In the lower lef corner, double-click on "Offset(h)".
  4. Paste the offset you gathered from the text file (in Hex) into the dialog Window and click "OK":
    HxD003
  5. This puts the cursor to the correct location
  6. Select the code starting from the Offset for the length you found previously. In my case 341:
    HxD04
  7. Copy the value to memory (CTRL+C)
  8. Open Editor, paste in the value and save the file as PPT01.txt or similar at a location which you can access from within macOS:
    PPT01
  9. Reboot into macOS

Gathering the PCI path of your dGPU

  • Run Hackintool
  • Click on the "PCIe" Tab
  • Find your GPU – it should be listed as "VGA Compatible Controller" – the Vendor should be AMD, not Intel! Intel = iGPU.
  • Right-click the entry and select "Copy Device Path":
    PCIpath

Editing the config.plist

  • Next, Mount your EFI
  • Open your config.plist with a Plist Editor
  • Create a new and Dictionary under DeviceProperties/Add
  • Double-click its name and paste in the Device Path (CMD+V). Usually it's PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0).
  • Next, create a new Key called PP_PhmSoftPowerPlayTable (Type: DATA)
  • Paste in the data from the PPT01.txt
  • The resulting entry should look similar to this:
    propertree01
  • Save your config.plist and reboot

Testing

Enable GPU Monitoring

To get a bit more insight on what's happening on your Hackintosh, we install some tools to monitor performance and Power Consumption of the GPU.

  • Install Intel Power Gadget
  • Install HWMonitorSMC2
  • Run HWMonitorSMC2
  • Click on the cog wheel to open the preferences
  • Enable the following options:
    HWMonSMC2_01
  • Close the settings. The HWMonitor Icon is now present in the Menubar. Click on it to show the monitored devices:
    HWMonSMC2

💡 Alternatively, you can monitor GPU usage via Terminal, using this command:

ioreg -l |grep \"PerformanceStatistics\" | cut -d '{' -f 2 | tr '|' ',' | tr -d '}' | tr ',' '\n'|grep 'Temp\|Fan\|Power\|Clock\|Utilization'

Run some Benchmark Tests

  • Open Geekbench
  • Click on "Compute"
  • Select your GPU from the "Compute Device" dropdown menu
  • Run Tests for Metal and OpenCL
  • Save your results
  • Open your config.plist
  • Put a # in front of PP_PhmSoftPowerPlayTable to disable the key
  • Reboot macOS and perform the tests again
  • Check power consumption, temps and clock speed in HWMonitorSMC2.

NOTE: Don't forget to re-enable PP_PhmSoftPowerPlayTable when you're done comparing test results.

Test results

Here are some Geekbench scores for my Sapphire Nitro+ Radeon RX 580 (4 GB):

  • Metal (stock): 51211
  • OpenCL (stock): 48076
  • Metal (with PowerPlay Table): 53023
  • OpenCL (with PowerPlay Table): 46030

Power consumption in idle (in Watts):

  • Stock: ≈ 100 W
  • Modded: ≈ 70 W

Example Files

Here are some example files by Jasonhacks with explanations about the sections of the PowerPlayInfo Table code. The tables are for a Sapphire Nitro+ Radeon RX 580 (8 GB). So unless you have the same model I wouldn't recommend just copying over the data 1:1. Instead, study the principle behind it. Download

Credits and Thank Yous