DEV Community

TiltedLunar123
TiltedLunar123

Posted on

A Ryzen 7 5800X came out at $80 next to a $200 i7 because my tool read AMD model numbers on Intel's scale

I have a little PowerShell script that looks at your PC's hardware and guesses what it'd sell for. Detect the CPU, GPU, RAM, storage, and age, price each part, add it up. I've been fixing it in small pieces for a couple months.

This week I ran it on a desktop with a Ryzen 7 5800X and the CPU line said $80. That's off by a lot. A used 5800X goes for way more. So I checked what an Intel chip from the same era does, dropped in an i7-10700, and got $200. Same class of part, same year, and my tool valued the AMD one at less than half.

Here's the pricing, roughly. A base value by tier, then a multiplier for how new the chip is.

# Base value by tier
if     ($name -match 'I9|RYZEN\s*9') { $baseValue = 300 }
elseif ($name -match 'I7|RYZEN\s*7') { $baseValue = 200 }
elseif ($name -match 'I5|RYZEN\s*5') { $baseValue = 120 }
elseif ($name -match 'I3|RYZEN\s*3') { $baseValue = 60 }

# Generation multiplier
$genMultiplier = if ($gen -ge 14) { 1.4 }
elseif ($gen -ge 12) { 1.2 }
elseif ($gen -ge 10) { 1.0 }
elseif ($gen -ge 8)  { 0.8 }
elseif ($gen -ge 6)  { 0.6 }
elseif ($gen -ge 4)  { 0.4 }
elseif ($gen -ge 1)  { 0.3 }
else                 { 0.7 }
Enter fullscreen mode Exit fullscreen mode

The tier part was fine. Ryzen 7 and i7 both land on 200. The problem was $gen.

That ladder was built for Intel, where the leading digits of the model number are the generation. An i7-10700 is 10th gen. An i9-14900K is 14th gen. So the code grabbed those digits and used them straight.

For AMD I was doing the same thing, and AMD doesn't count like that. A Ryzen 7 5800X is a 5000-series part, but 5000 doesn't mean the fifth generation of anything Intel would recognize. It's Zen 3, from late 2020, which lines up against Intel's 11th gen. My code read the 5, called it generation 5, and dropped it in the $gen -ge 4 band, which is the 0.4 multiplier meant for 2015 Skylake chips. 200 times 0.4 is 80.

The top of the stack was worse. A Ryzen 9 9950X (Zen 5, 2024) read as generation 9, hit the 0.8 band, and came out at $240 while an i9-14900K sitting next to it got $420.

The fix is to translate the series digit into the Intel generation the part actually launched against, before the shared ladder ever sees it.

if ($name -match 'RYZEN\s*(?:\d\s+)?(?:PRO\s+)?(\d)\d{3}') {
    $amdGen = switch ([int]$Matches[1]) {
        1 { 7 }    # Zen, 2017
        2 { 8 }    # Zen+, 2018
        3 { 9 }    # Zen 2, 2019
        4 { 10 }   # Zen 2 mobile/APU, 2020
        5 { 11 }   # Zen 3, 2020
        6 { 12 }   # Zen 3+ mobile, 2022
        7 { 13 }   # Zen 4, 2022
        8 { 14 }   # Zen 4 APU, 2024
        9 { 15 }   # Zen 5, 2024
        default { 0 }
    }
}
$gen = [math]::Max($intelGen, $amdGen)
Enter fullscreen mode Exit fullscreen mode

Now the 5800X reads as gen 11, hits the 1.0 band, and comes out at $200, same as the i7-10700. I added three vendor pairs as tests (10700 vs 5800X, 14900K vs 9950X, 9400F vs 3600) that assert both sides price the same, so if I ever touch this ladder again and knock AMD back down, the suite catches it.

That regex has a second thing baked in. It optionally allows a PRO token, because "Ryzen 7 PRO 5850U" was slipping past the old pattern and falling all the way to the else branch (0.7), which somehow made a slower laptop chip worth more than the desktop 5800X it should lose to. Fixing the generation math and the PRO name in the same pass lined both back up.

While I had the valuation code open I hit a GPU version of the same mistake. Every discrete Intel Arc card reports its name as something like "Intel(R) Arc(TM) A770 Graphics." My integrated-GPU check was matching on the word "Graphics," so it flagged every Arc card as integrated, valued it at $0, and then the code that picks the primary GPU skips integrated cards. An Arc-only build reported no discrete GPU at all.

I couldn't just exclude "Arc," because the iGPU baked into Core Ultra chips is also called "Intel(R) Arc(TM) Graphics." The thing that separates them is the model number: discrete cards carry an A or B code, the integrated one doesn't.

function Get-GPUIntegratedFlag {
    param([string]$Name)
    if ($Name -match 'Arc\b.*\b[AB]\d{3}\b') { return $false }
    return [bool]($Name -match 'Intel.*(?:UHD|HD|Iris|Graphics)|AMD.*Radeon.*Graphics$|Vega.*Graphics')
}
Enter fullscreen mode Exit fullscreen mode

Pulling that into its own function was half the fix. It used to live inside the big hardware-detection function behind live CIM queries, which is exactly why it never had a test. On its own it takes a string and returns a bool, so I could throw the real reported names at it: the A-series and B-series cards come back discrete, the bare "Arc Graphics" and a plain UHD 770 come back integrated.

What's still rough, and I left it on purpose:

  • The AMD map is a lookup, not real knowledge. It doesn't know clock speeds or core counts, so two chips in the same tier and generation get the same number even if one is clearly faster.
  • Making the tier digit optional in that regex means a Threadripper name could in theory get read as a low-gen desktop part. Right now the 4-digit model requirement and the word "Threadripper" sitting in the way keep it from matching, but that's luck as much as design.
  • The whole thing still values a CPU on tier and generation alone. A 65W and a 105W part of the same name price identically.

It's a hobby script, not a pricing service, so being in the right ballpark and not embarrassingly wrong is the bar. Reading AMD on an Intel ruler was embarrassingly wrong.

Repo: https://github.com/TiltedLunar123/pc-worth

Top comments (0)