initial support for Zen5

This commit is contained in:
JanLJL
2026-01-12 19:47:00 +01:00
parent 6f9b7c4e89
commit f3ecee28d1
5 changed files with 39718 additions and 15 deletions

View File

@@ -171,6 +171,8 @@ Supported microarchitectures
+----------+-----------------+------------+
| AMD | Genoa / Zen 4 | ``ZEN4`` |
+----------+-----------------+------------+
| AMD | Turin / Zen 5 | ``ZEN5`` |
+----------+-----------------+------------+
**ARM AArch64 CPUs**

39665
osaca/data/zen5.yml Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -35,6 +35,7 @@ SUPPORTED_ARCHS = [
"ZEN2",
"ZEN3",
"ZEN4",
"ZEN5",
"TX2",
"N1",
"A64FX",

View File

@@ -5,6 +5,7 @@ class InstructionForm:
def __init__(
self,
mnemonic=None,
llvm_name=None,
operands=[],
hidden_operands=[],
directive_id=None,
@@ -22,6 +23,7 @@ class InstructionForm:
normalized=False,
):
self._mnemonic = mnemonic
self._llvm_name = llvm_name
self._operands = operands
self._hidden_operands = hidden_operands
self._directive_id = directive_id
@@ -56,6 +58,10 @@ class InstructionForm:
def mnemonic(self):
return self._mnemonic
@property
def llvm_name(self):
return self._llvm_name
@property
def label(self):
return self._label_id
@@ -160,6 +166,10 @@ class InstructionForm:
def mnemonic(self, mnemonic):
self._mnemonic = mnemonic
@llvm_name.setter
def llvm_name(self, llvm_name):
self._llvm_name = llvm_name
@label.setter
def label(self, label):
self._label_id = label
@@ -203,6 +213,7 @@ class InstructionForm:
def __str__(self):
attributes = {
"mnemonic": self.mnemonic,
"llvm_name": self._llvm_name,
"operands": self.operands,
"hidden_operands": self.hidden_operands,
"directive_id": self.directive,
@@ -226,13 +237,24 @@ class InstructionForm:
def __eq__(self, other):
if isinstance(other, InstructionForm):
return (
self._mnemonic == other._mnemonic
and self._directive_id == other._directive_id
and self._comment_id == other._comment_id
and self._label_id == other._label_id
and self._line == other._line
and self._line_number == other._line_number
and self._semantic_operands == other._semantic_operands
)
if len(self._semantic_operands["source"] + self._semantic_operands["destination"] + self._semantic_operands["src_dst"]) > 0:
return (
self._mnemonic == other._mnemonic
and self._directive_id == other._directive_id
and self._comment_id == other._comment_id
and self._label_id == other._label_id
and self._line == other._line
and self._line_number == other._line_number
and self._semantic_operands == other._semantic_operands
)
else:
return (
self._mnemonic == other._mnemonic
and self._directive_id == other._directive_id
and self._comment_id == other._comment_id
and self._label_id == other._label_id
and self._line == other._line
and self._line_number == other._line_number
and self._operands == other._operands
)
return False

View File

@@ -338,6 +338,7 @@ class MachineModel(object):
def set_instruction(
self,
mnemonic,
llvm_name=None,
operands=None,
latency=None,
port_pressure=None,
@@ -353,6 +354,7 @@ class MachineModel(object):
self._data["instruction_forms_dict"][mnemonic].append(instr_data)
instr_data.mnemonic = mnemonic
instr_data.llvm_name = llvm_name
instr_data.operands = operands
instr_data.latency = latency
instr_data.port_pressure = port_pressure
@@ -365,6 +367,7 @@ class MachineModel(object):
raise KeyError
self.set_instruction(
entry.mnemonic,
entry.llvm_name,
entry.operands,
entry.latency,
entry.port_pressure,
@@ -456,6 +459,7 @@ class MachineModel(object):
"zen2": "x86",
"zen3": "x86",
"zen4": "x86",
"zen5": "x86",
"con": "x86", # Intel Conroe
"wol": "x86", # Intel Wolfdale
"snb": "x86",
@@ -521,15 +525,24 @@ class MachineModel(object):
for key, value in instruction_form.__dict__.items()
if not callable(value) and not key.startswith("__")
)
if instruction_form["port_pressure"] is not None:
cs = ruamel.yaml.comments.CommentedSeq(instruction_form["port_pressure"])
cs.fa.set_flow_style()
instruction_form["port_pressure"] = cs
iform = {
"name": instruction_form["name"] if "name" in instruction_form else instruction_form["mnemonic"]
}
if "llvm_name" in instruction_form:
iform["llvm_name"] = instruction_form["llvm_name"]
dict_operands = []
for op in instruction_form["operands"]:
dict_operands.append(self.class_to_dict(op))
instruction_form["operands"] = dict_operands
formatted_instruction_forms.append(instruction_form)
iform["operands"] = dict_operands
iform["latency"] = instruction_form["latency"]
if instruction_form["port_pressure"] is not None:
cs = ruamel.yaml.comments.CommentedSeq(instruction_form["port_pressure"])
cs.fa.set_flow_style()
iform["port_pressure"] = cs
iform["throughput"] = instruction_form["throughput"]
if "uops" in instruction_form:
iform["uops"] = instruction_form["uops"]
formatted_instruction_forms.append(iform)
# Replace load_throughput with styled version for RoundtripDumper
formatted_load_throughput = []