From fe0fa88753ba685818f9c4c490eb698bc061913a Mon Sep 17 00:00:00 2001 From: Michael McKinsey Date: Fri, 5 Dec 2025 14:52:19 -0800 Subject: [PATCH 1/3] Add support for reading rocm kernels from rocm-activity-profile --- hatchet/readers/caliper_native_reader.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/hatchet/readers/caliper_native_reader.py b/hatchet/readers/caliper_native_reader.py index 00ebe63f..3dca5981 100644 --- a/hatchet/readers/caliper_native_reader.py +++ b/hatchet/readers/caliper_native_reader.py @@ -167,6 +167,14 @@ def read_metrics(self, ctx="path"): elif record["cupti.activity.kind"] == "memcpy": node_label = record["cupti.activity.kind"] node_callpath = tuple(record[ctx] + [node_label]) + # rocm records + elif "rocm.activity" in record: + if record["rocm.activity"] == "KernelExecution": + node_label = record["rocm.kernel.name"] + node_callpath = tuple(record[ctx] + [node_label]) + else: + node_label = record["rocm.activity"] + node_callpath = tuple(record[ctx] + [node_label]) # Sampling elif "module#cali.sampler.pc" in record: node_label = record["source.function#cali.sampler.pc"] @@ -306,6 +314,18 @@ def _create_parent(child_node, parent_callpath): node_type = "memcpy" else: Exception("Haven't seen this activity kind yet") + # rocm records + elif "rocm.activity" in record: + if record["rocm.activity"] == "KernelExecution": + node_label = record["rocm.kernel.name"] + node_callpath = tuple(record[ctx] + [node_label]) + parent_callpath = node_callpath[:-1] + node_type = "kernel" + else: + node_label = record["rocm.activity"] + node_callpath = tuple(record[ctx] + [node_label]) + parent_callpath = node_callpath[:-1] + node_type = "other" # Sampling elif "module#cali.sampler.pc" in record: node_label = record["source.function#cali.sampler.pc"] @@ -453,7 +473,7 @@ def read(self): # add missing intermediate nodes to the df_fixed_data dataframe if "mpi.rank" in df_fixed_data.columns: num_ranks = metrics["mpi.rank"].max() + 1 - rank_list = range(0, num_ranks) + rank_list = range(0, int(num_ranks)) # create a standard dict to be used for filling all missing rows default_metric_dict = {} From 20f54e05a014d11a956df63156e195bee9a5e022 Mon Sep 17 00:00:00 2001 From: Michael McKinsey Date: Fri, 5 Dec 2025 15:56:39 -0800 Subject: [PATCH 2/3] Update caliper_native_reader.py --- hatchet/readers/caliper_native_reader.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hatchet/readers/caliper_native_reader.py b/hatchet/readers/caliper_native_reader.py index 3dca5981..a0f530f9 100644 --- a/hatchet/readers/caliper_native_reader.py +++ b/hatchet/readers/caliper_native_reader.py @@ -321,11 +321,15 @@ def _create_parent(child_node, parent_callpath): node_callpath = tuple(record[ctx] + [node_label]) parent_callpath = node_callpath[:-1] node_type = "kernel" - else: + 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 + pop_item = record[ctx].pop() node_callpath = tuple(record[ctx] + [node_label]) parent_callpath = node_callpath[:-1] - node_type = "other" + node_type = "memcpy" + else: + Exception("Haven't seen this activity kind yet") # Sampling elif "module#cali.sampler.pc" in record: node_label = record["source.function#cali.sampler.pc"] From 949b2b4633f3c27d209029c241ae24296cf25dda Mon Sep 17 00:00:00 2001 From: Michael McKinsey Date: Mon, 15 Dec 2025 11:06:18 -0800 Subject: [PATCH 3/3] Update caliper_native_reader.py --- hatchet/readers/caliper_native_reader.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hatchet/readers/caliper_native_reader.py b/hatchet/readers/caliper_native_reader.py index a0f530f9..a1acebfc 100644 --- a/hatchet/readers/caliper_native_reader.py +++ b/hatchet/readers/caliper_native_reader.py @@ -324,7 +324,7 @@ def _create_parent(child_node, parent_callpath): 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 - pop_item = record[ctx].pop() + record[ctx].pop() node_callpath = tuple(record[ctx] + [node_label]) parent_callpath = node_callpath[:-1] node_type = "memcpy"