[PATCH] D137695: [X86] Add missing Zen3+ model subtypes

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 00:34:58 PST 2022


RKSimon created this revision.
RKSimon added reviewers: pengfei, craig.topper, MaskRay, FreddyYe, lebedev.ri.
Herald added subscribers: Enna1, StephenFan, hiraditya.
Herald added a project: All.
RKSimon requested review of this revision.
Herald added projects: Sanitizers, LLVM.
Herald added a subscriber: Sanitizers.

This patch adds support for detecting Zen3+ subtypes (Rembrandt/Barcelo/Cezanne)

Based off a mixture of https://github.com/torvalds/linux/blob/master/drivers/hwmon/k10temp.c#L436 and InstLatx64 https://github.com/InstLatx64/InstLatx64/tree/master/AuthenticAMD CPUID dumps.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137695

Files:
  compiler-rt/lib/builtins/cpu_model.c
  llvm/lib/Support/Host.cpp


Index: llvm/lib/Support/Host.cpp
===================================================================
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -1075,6 +1075,10 @@
       *Subtype = X86::AMDFAM19H_ZNVER3;
       break; // 00h-0Fh, 21h: Zen3
     }
+    if (Model >= 0x40 && Model <= 0x5f) {
+      *Subtype = X86::AMDFAM19H_ZNVER3;
+      break; // 40h-4fFh, 50h-5fh: Zen3+
+    }
     break;
   default:
     break; // Unknown AMD CPU.
Index: compiler-rt/lib/builtins/cpu_model.c
===================================================================
--- compiler-rt/lib/builtins/cpu_model.c
+++ compiler-rt/lib/builtins/cpu_model.c
@@ -590,6 +590,10 @@
       *Subtype = AMDFAM19H_ZNVER3;
       break; // 00h-0Fh, 21h: Zen3
     }
+    if (Model >= 0x40 && Model <= 0x5f) {
+      *Subtype = AMDFAM19H_ZNVER3;
+      break; // 40h-4fFh, 50h-5fh: Zen3+
+    }
     break;
   default:
     break; // Unknown AMD CPU.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137695.474176.patch
Type: text/x-patch
Size: 935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221109/1eeeb6ae/attachment.bin>


More information about the llvm-commits mailing list