From 950924438f3e479cb8aec468d73fdcb007faa98f Mon Sep 17 00:00:00 2001 From: Rachida Kebichi Date: Tue, 11 May 2021 17:42:34 -0400 Subject: [PATCH] SWDEV-284863 Fixed several issues preventing memcpy info dump in csv 1st issue was that one of the ostream ops failed to print the content of the struct. 2nd issue: get_ptr_type was called with args being src/dest pointers while it should be the agents pointers for src/dest. 3rd issue: memcopies map used (recordid, procid, is_async) as a key but this is not enough as some copies share same key, so I added begin/end timestamps as a way to distinguish between them. Change-Id: I7c6e80e74e30ea572f21612aaf0cf7efec6e91e6 [ROCm/rocprofiler commit: 761bd6a86be2b2f4fa578962f9bcf08661a42933] --- projects/rocprofiler/bin/mem_manager.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/projects/rocprofiler/bin/mem_manager.py b/projects/rocprofiler/bin/mem_manager.py index 551229f424..d2f0e8f1db 100755 --- a/projects/rocprofiler/bin/mem_manager.py +++ b/projects/rocprofiler/bin/mem_manager.py @@ -95,12 +95,12 @@ class MemManager: size_ptrn = re.compile(DELIM + 'Size=(\d+)' + DELIM) # query syncronous memcopy API record - key = (recordid,procid,0) + key = (recordid, procid, 0) if key in self.memcopies: data = self.memcopies[key] # query asyncronous memcopy API record - key = (recordid,procid,1) + key = (recordid, procid, 1) if key in self.memcopies: if data != '': fatal('register_copy: corrupted record sync/async') @@ -299,30 +299,30 @@ class MemManager: if m_basic_hsa_prev: dstptr = m_basic_hsa_prev.group(1) - dstptr_type = self.get_ptr_type(dstptr) dst_agent_ptr = m_basic_hsa_prev.group(2) + dstptr_type = self.get_ptr_type(dst_agent_ptr) srcptr = m_basic_hsa_prev.group(3) - srcptr_type = self.get_ptr_type(srcptr) src_agent_ptr = m_basic_hsa_prev.group(4) + srcptr_type = self.get_ptr_type(src_agent_ptr) size = int(m_basic_hsa_prev.group(5)) condition_matched = True if m_basic_hsa: dstptr = m_basic_hsa.group(1) - dstptr_type = self.get_ptr_type(dstptr) dst_agent_ptr = m_basic_hsa.group(2) + dstptr_type = self.get_ptr_type(dst_agent_ptr) srcptr = m_basic_hsa.group(3) - srcptr_type = self.get_ptr_type(srcptr) src_agent_ptr = m_basic_hsa.group(4) + srcptr_type = self.get_ptr_type(src_agent_ptr) size = int(m_basic_hsa.group(5)) condition_matched = True if m_basic_hsa2: dstptr = m_basic_hsa2.group(1) - dstptr_type = self.get_ptr_type(dstptr) - dst_agent_ptr = m_basic_hsa2.group(4) + dst_agent_ptr = m_basic_hsa2.group(6) + dstptr_type = self.get_ptr_type(dst_agent_ptr) srcptr = m_basic_hsa2.group(2) - srcptr_type = self.get_ptr_type(srcptr) - src_agent_ptr = m_basic_hsa2.group(4) + src_agent_ptr = m_basic_hsa2.group(6) + srcptr_type = self.get_ptr_type(src_agent_ptr) z = int(m_basic_hsa2.group(3)) y = int(m_basic_hsa2.group(4)) x = int(m_basic_hsa2.group(5)) @@ -379,9 +379,8 @@ class MemManager: copy_line_header = '' copy_line_footer = '' - if not is_async or is_hip: - copy_line_header = str(start_time) + DELIM + str(end_time) + DELIM + str(pid) + DELIM + str(tid) - copy_line_footer = "BW=" + str(bandwidth) + DELIM + 'Async=' + str(is_async) + copy_line_header = str(start_time) + DELIM + str(end_time) + DELIM + str(pid) + DELIM + str(tid) + copy_line_footer = "BW=" + str(bandwidth) + DELIM + 'Async=' + str(is_async) copy_line = copy_line_header + DELIM + event + DELIM + 'Direction=' + direction + DELIM + 'SrcType=' + srcptr_type + DELIM + 'DstType=' + dstptr_type + DELIM + "Size=" + str(size) + DELIM + copy_line_footer