Readying.

This commit is contained in:
pleroy
2025-01-05 12:13:50 +01:00
parent 969500d79f
commit df0351d087
2 changed files with 6 additions and 5 deletions

View File

@@ -82,9 +82,8 @@ class KernelDG(nx.DiGraph):
:type flag_dependencies: boolean, optional
:returns: :class:`~nx.DiGraph` -- directed graph object
"""
# 1. go through kernel instruction forms and add them as node attribute
# 2. find edges (to dependend further instruction)
# 3. get LT value and set as edge weight
# Go through kernel instruction forms and add them as nodes of the graph. Create a LOAD
# node for instructions that include a memory reference.
dg = nx.DiGraph()
loads = {}
for i, instruction_form in enumerate(kernel):
@@ -110,11 +109,14 @@ class KernelDG(nx.DiGraph):
instruction_form.line_number,
latency=instruction_form.latency - instruction_form.latency_wo_load,
)
#TODO comments
# 1. find edges (to dependend further instruction)
# 2. get LT value and set as edge weight
for i, instruction_form in enumerate(kernel):
for dep, dep_flags in self.find_depending(
instruction_form, kernel[i + 1 :], flag_dependencies
):
# print(instruction_form.line_number,"\t",dep.line_number,"\n")
edge_weight = (
instruction_form.latency
if "mem_dep" in dep_flags or instruction_form.latency_wo_load is None