Skip to content

Instantly share code, notes, and snippets.

@sibradzic
Created April 28, 2024 11:32
Show Gist options
  • Save sibradzic/c2909fbd0ad8cd78474ecf887db1b013 to your computer and use it in GitHub Desktop.
Save sibradzic/c2909fbd0ad8cd78474ecf887db1b013 to your computer and use it in GitHub Desktop.
Checks PPT limits in the VBIOS of 32 RDNA2 & RDNA3 cards
#!/bin/bash
# This gets the PPT limits for varous RDNA2 & RDNA3 Radeon cards, by looking into
# PowerPlay table, which is part or the card's VBIOS. Looks into cards like AMD
# reference, ASRock ITX, Sapphire Reference/Pulse, PowerColor Reference/Fighter.
# Requires https://github.com/sibradzic/upp
RDNA2_VBIOSes="
https://www.techpowerup.com/vgabios/238514/Sapphire.RX6600.8192.210615.rom
https://www.techpowerup.com/vgabios/238416/Powercolor.RX6600.8192.210830.rom
https://www.techpowerup.com/vgabios/237318/ASRock.RX6600XT.8192.210625.rom
https://www.techpowerup.com/vgabios/237573/Sapphire.RX6600XT.8192.210715.rom
https://www.techpowerup.com/vgabios/236408/Powercolor.RX6600XT.8192.210701_1.rom
https://www.techpowerup.com/vgabios/247626/Sapphire.RX6700.10240.220502.rom
https://www.techpowerup.com/vgabios/247816/Powercolor.RX6700.10240.220615.rom
https://www.techpowerup.com/vgabios/231451/AMD.RX6700XT.12288.210125.rom
https://www.techpowerup.com/vgabios/241375/Sapphire.RX6700XT.12288.210623.rom
https://www.techpowerup.com/vgabios/232293/Powercolor.RX6700XT.12288.210303.rom
https://www.techpowerup.com/vgabios/230803/AMD.RX6800XT.16384.201007.rom
https://www.techpowerup.com/vgabios/259632/Sapphire.RX6800XT.16384.211230.rom
https://www.techpowerup.com/vgabios/235803/Powercolor.RX6800XT.16384.201029.rom
https://www.techpowerup.com/vgabios/230799/AMD.RX6900XT.16384.201104.rom
https://www.techpowerup.com/vgabios/230816/Sapphire.RX6900XT.16384.201104.rom
https://www.techpowerup.com/vgabios/230887/Powercolor.RX6900XT.16384.201104.rom
"
RDNA2plus_VBIOSes="
https://www.techpowerup.com/vgabios/246094/Sapphire.RX6650XT.8192.220225.rom
https://www.techpowerup.com/vgabios/245868/Powercolor.RX6650XT.8192.220303.rom
https://www.techpowerup.com/vgabios/245747/AMD.RX6750XT.12288.220125.rom
https://www.techpowerup.com/vgabios/245691/Powercolor.RX6750XT.12288.220302.rom
https://www.techpowerup.com/vgabios/245777/AMD.RX6950XT.16384.220310.rom
https://www.techpowerup.com/vgabios/245470/Sapphire.RX6950XT.16384.220331.rom
"
RDNA3_VBIOSes="
https://www.techpowerup.com/vgabios/257918/AMD.RX7600.8192.221129.rom
https://www.techpowerup.com/vgabios/257920/Sapphire.RX7600.8192.230416.rom
https://www.techpowerup.com/vgabios/257937/Powercolor.RX7600.8192.230425.rom
https://www.techpowerup.com/vgabios/260693/Sapphire.RX7700XT.12288.230720.rom
https://www.techpowerup.com/vgabios/260662/AMD.RX7800XT.16384.230714.rom
https://www.techpowerup.com/vgabios/260649/Sapphire.RX7800XT.16384.230802_1.rom
https://www.techpowerup.com/vgabios/260700/Powercolor.RX7800XT.16384.230808_1.rom
https://www.techpowerup.com/vgabios/262809/AMD.RX7900XTX.24576.230323.rom
https://www.techpowerup.com/vgabios/254079/Sapphire.RX7900XTX.24576.221129.rom
https://www.techpowerup.com/vgabios/252681/Powercolor.RX7900XTX.24576.221121.rom
"
# TechPowerUp downloads are rate limited, you'll get 492 and trigger captcha for more than ~20 requests, download partially
VBIOSes="${RDNA2_VBIOSes} ${RDNA2plus_VBIOSes} ${RDNA3_VBIOSes}"
for LINK in $VBIOSes; do
if [ ! -r ${LINK##*/}.html ]; then
curl -sL ${LINK%.*} -o ${LINK##*/}.html
fi
if [ ! -r ${LINK##*/} ]; then
echo Downloading ${LINK##*/}
curl ${LINK} -o ${LINK##*/}
fi
done
echo "Analyzing BIOS files..."
for LINK in $VBIOSes; do
CARD=${LINK##*/}
echo -n " Model: "
sed -n 's|.*<h1 class=\"biostitle\">\(.*\)</h1>|\1 |p;s|.*<h2>\(.*\)</h2>|\1 |p' ${CARD}.html | tr -d '\n'
upp -p ${CARD}.pp_table extract -r ${CARD} | grep " [0-9A-Z]*" | head -n5 | tr -d '\n' | xargs
echo " Card's max power limit range set in VBIOS PowerPlay table:"
PP_TABLE_REV=$(upp -p ${CARD}.pp_table get /header/format_revision | tail -n1)
if [ ${PP_TABLE_REV} -lt 20 ]; then
TDC_LIMIT_PATH=smc_pptable/SocketPowerLimitAc/0
else
TDC_LIMIT_PATH=smc_pptable/SkuTable/SocketPowerLimitAc/0
fi
TDC_LIMIT=$(upp -p ${CARD}.pp_table get ${TDC_LIMIT_PATH} | tail -n1)
MAX_OVERRIDE_PERCENT=$(upp -p ${CARD}.pp_table dump | grep POWERPERCENT | sed -n 's|[ ]*max [0-9]: \([0-9]*\) (POWERPERCENTAGE)|\1|p')
MIN_OVERRIDE_PERCENT=$(upp -p ${CARD}.pp_table dump | grep POWERPERCENT | sed -n 's|[ ]*min [0-9]: \([0-9]*\) (POWERPERCENTAGE)|\1|p')
echo " Default TDC limit: ${TDC_LIMIT}W"
echo " Max TDC limit: $(( ${TDC_LIMIT}+${TDC_LIMIT}*${MAX_OVERRIDE_PERCENT}/100 ))W (+${MAX_OVERRIDE_PERCENT}%)"
echo " Min TDC limit: $(( ${TDC_LIMIT}-${TDC_LIMIT}*${MIN_OVERRIDE_PERCENT}/100 ))W (-${MIN_OVERRIDE_PERCENT}%)"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment