Skip to content

Commit

Permalink
AMD Zen 3 CPU support (Fixes #45657) (#45663) (#45667)
Browse files Browse the repository at this point in the history
I've omitted `invpcid` feature since it's clearly omitted for other CPU's.

Fixes #45657

(cherry picked from commit 3f047f7)
  • Loading branch information
LebedevRI authored Jun 14, 2022
1 parent 3a2eb39 commit 8fd0b2a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/processor_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ enum class CPU : uint32_t {
amd_barcelona,
amd_znver1,
amd_znver2,
amd_znver3,
};

static constexpr size_t feature_sz = 11;
Expand Down Expand Up @@ -222,6 +223,7 @@ constexpr auto bdver4 = bdver3 | get_feature_masks(avx2, bmi2, mwaitx, movbe, rd
constexpr auto znver1 = haswell | get_feature_masks(adx, aes, clflushopt, clzero, mwaitx, prfchw,
rdseed, sha, sse4a, xsavec, xsaves);
constexpr auto znver2 = znver1 | get_feature_masks(clwb, rdpid, wbnoinvd);
constexpr auto znver3 = znver2 | get_feature_masks(shstk, pku, vaes, vpclmulqdq);

}

Expand Down Expand Up @@ -280,6 +282,7 @@ static constexpr CPUSpec<CPU, feature_sz> cpus[] = {

{"znver1", CPU::amd_znver1, CPU::generic, 0, Feature::znver1},
{"znver2", CPU::amd_znver2, CPU::generic, 0, Feature::znver2},
{"znver3", CPU::amd_znver3, CPU::amd_znver2, 120000, Feature::znver3},
};
static constexpr size_t ncpu_names = sizeof(cpus) / sizeof(cpus[0]);

Expand Down Expand Up @@ -543,6 +546,10 @@ static CPU get_amd_processor_name(uint32_t family, uint32_t model, const uint32_
if (model >= 0x30)
return CPU::amd_znver2;
return CPU::amd_znver1;
case 0x19: // AMD Family 19h
if (model <= 0x0f || model == 0x21)
return CPU::amd_znver3; // 00h-0Fh, 21h: Zen3
return CPU::amd_znver3; // fallback
}
}

Expand Down

0 comments on commit 8fd0b2a

Please sign in to comment.