Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions hatchet/readers/caliper_native_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def read_metrics(self, ctx="path"):
node_callpath = tuple(record[ctx] + [node_label])
# rocm records
elif "rocm.activity" in record:
if record["rocm.activity"] == "KernelExecution":
if record["rocm.activity"] == "KERNEL_DISPATCH_COMPLETE":
node_label = record["rocm.kernel.name"]
node_callpath = tuple(record[ctx] + [node_label])
else:
Expand All @@ -184,8 +184,12 @@ def read_metrics(self, ctx="path"):
node_callpath = tuple(record[ctx])[:-1] + (node_label,)
sampling = True
else:
node_label = record[ctx][-1]
node_callpath = tuple(record[ctx])
if len(record[ctx]) > 0:
node_label = record[ctx][-1]
node_callpath = tuple(record[ctx])
else:
node_label = "unknown_context"
node_callpath = tuple("unknown_context")
else:
node_label = record[ctx]
node_callpath = tuple([record[ctx]])
Expand Down Expand Up @@ -319,15 +323,16 @@ def _create_parent(child_node, parent_callpath):
Exception("Haven't seen this activity kind yet")
# rocm records
elif "rocm.activity" in record:
if record["rocm.activity"] == "KernelExecution":
if record["rocm.activity"] == "KERNEL_DISPATCH_COMPLETE":
node_label = record["rocm.kernel.name"]
node_callpath = tuple(record[ctx] + [node_label])
parent_callpath = node_callpath[:-1]
node_type = "kernel"
elif "hipMemcpy" in record["rocm.api"]:
node_label = record["rocm.activity"]
# Theres going to be an extra record at the end that we must remove
record[ctx].pop()
if len(record[ctx]) > 0:
record[ctx].pop()
node_callpath = tuple(record[ctx] + [node_label])
parent_callpath = node_callpath[:-1]
node_type = "memcpy"
Expand All @@ -340,10 +345,16 @@ def _create_parent(child_node, parent_callpath):
parent_callpath = node_callpath[:-1]
node_type = "function"
else:
node_label = record[ctx][-1]
node_callpath = tuple(record[ctx])
parent_callpath = node_callpath[:-1]
node_type = "function"
if len(record[ctx]) > 0:
node_label = record[ctx][-1]
node_callpath = tuple(record[ctx])
parent_callpath = node_callpath[:-1]
node_type = "function"
else:
node_label = "unknown_context"
node_callpath = tuple("unknown_context")
parent_callpath = tuple("")
node_type = "function"

hnode = self.callpath_to_node.get(node_callpath)

Expand Down
Loading