Hidden operands and dependency break in iforms now included

This commit is contained in:
stefandesouza
2023-10-23 21:54:58 +02:00
parent c171a11101
commit e0a2ea9eb2
2 changed files with 18 additions and 14 deletions

View File

@@ -73,7 +73,7 @@ class MachineModel(object):
self._data = MachineModel._runtime_cache[self._path]
# check if file is cached
cached = self._get_cached(self._path) if not lazy else False
if cached:
if False:
self._data = cached
else:
yaml = self._create_yaml_object()
@@ -104,10 +104,8 @@ class MachineModel(object):
self._data["instruction_forms_dict"] = defaultdict(list)
for iform in self._data["instruction_forms"]:
if "hidden_operands" in iform:
print("hidden")
if "breaks_dependency_on_equal_operands" in iform:
print("breaks")
print(iform["breaks_dependency_on_equal_operands"],"\n")
iform["name"] = iform["name"].upper()
if iform["operands"] != []:
new_operands = []
@@ -115,18 +113,28 @@ class MachineModel(object):
for o in iform["operands"]:
self.operand_to_class(o, new_operands)
iform["operands"] = new_operands
# Do the same for hidden operands
if iform["hidden_operands"] != []:
new_operands = []
# Change operand types from dicts to classes
for o in iform["hidden_operands"]:
self.operand_to_class(o, new_operands)
iform["hidden_operands"] = new_operands
# Change dict iform style to class style
new_iform = InstructionForm(
INSTRUCTION_ID=iform["name"].upper() if "name" in iform else None,
OPERANDS_ID=new_operands if "operands" in iform else [],
OPERANDS_ID=iform["operands"] if "operands" in iform else [],
HIDDEN_OPERANDS=iform["hidden_operands"] if "hidden_operansd" in iform else [],
DIRECTIVE_ID=iform["directive"] if "directive" in iform else None,
COMMENT_ID=iform["comment"] if "comment" in iform else [],
COMMENT_ID=iform["comment"] if "comment" in iform else None,
LINE=iform["line"] if "line" in iform else None,
LINE_NUMBER=iform["line_number"] if "line_number" in iform else None,
LATENCY=iform["latency"] if "latency" in iform else None,
THROUGHPUT=iform["throughput"] if "throughput" in iform else None,
UOPS=iform["uops"] if "uops" in iform else None,
PORT_PRESSURE=iform["port_pressure"] if "port_pressure" in iform else None,
BREAKS_DEP=iform["breaks_dependency_on_equal_operands"] if "breaks_dependency_on_equal_operands" in iform else False,
SEMANTIC_OPERANDS=iform["semantic_operands"]
if "semantic_operands" in iform
else {"source": [], "destination": [], "src_dst": []},
@@ -134,9 +142,6 @@ class MachineModel(object):
# List containing classes with same name/instruction
self._data["instruction_forms_dict"][iform["name"]].append(new_iform)
# Change memory dicts in load/store throughput to operand class
self.load_store_tp()
self._data["internal_version"] = self.INTERNAL_VERSION
if not lazy:
@@ -832,7 +837,6 @@ class MachineModel(object):
def _is_AArch64_mem_type(self, i_mem, mem):
"""Check if memory addressing type match."""
print(mem)
if (
# check base
(

View File

@@ -349,7 +349,7 @@ class TestSemanticTools(unittest.TestCase):
tp_optimal = self.semantics_tx2.get_throughput_sum(kernel_optimal)
self.assertNotEqual(tp_fixed, tp_optimal)
self.assertTrue(max(tp_optimal) <= max(tp_fixed))
"""
def test_kernelDG_x86(self):
#
# 4
@@ -420,7 +420,7 @@ class TestSemanticTools(unittest.TestCase):
dg.get_dependent_instruction_forms()
# test dot creation
dg.export_graph(filepath="/dev/null")
"""
def test_kernelDG_SVE(self):
KernelDG(
@@ -463,7 +463,7 @@ class TestSemanticTools(unittest.TestCase):
with self.assertRaises(NotImplementedError):
dg.get_loopcarried_dependencies()
"""
def test_loop_carried_dependency_aarch64(self):
dg = KernelDG(
self.kernel_aarch64_memdep,
@@ -512,7 +512,7 @@ class TestSemanticTools(unittest.TestCase):
[(iform.line_number, lat) for iform, lat in lc_deps[dep_path]["dependencies"]],
[(4, 1.0), (5, 1.0), (10, 1.0), (11, 1.0), (12, 1.0)],
)
"""
def test_loop_carried_dependency_x86(self):
lcd_id = "8"