diff --git a/projects/rocprofiler/bin/mem_manager.py b/projects/rocprofiler/bin/mem_manager.py index 951e34f71b..a0d0614fe6 100755 --- a/projects/rocprofiler/bin/mem_manager.py +++ b/projects/rocprofiler/bin/mem_manager.py @@ -98,9 +98,6 @@ class MemManager: found = 0 for base in self.allocations.keys(): (size, event) = self.allocations[base] - size = re.sub('\).*$', '', size) - size = '0x' + size - #print("ptr(" + str(ptr) + ") base(" + base + ") size='" + size + "'") if int(ptr, 16) >= int(base, 16) and int(ptr, 16) < int(base, 16) + int(size, 16): found = 1 break @@ -110,6 +107,8 @@ class MemManager: ptr_type = 'pinned' elif event in ondevice: ptr_type = 'device' + else: + fatal('internal error: ptr(' + ptr + ') cannot be identified') return ptr_type # add memcpy to map diff --git a/projects/rocprofiler/bin/sqlitedb.py b/projects/rocprofiler/bin/sqlitedb.py index f24657228e..62553a8141 100644 --- a/projects/rocprofiler/bin/sqlitedb.py +++ b/projects/rocprofiler/bin/sqlitedb.py @@ -159,9 +159,8 @@ class SQLiteDB: for ind in range(len(from_us_list)): corr_id = corr_id_list[ind] if (len(corr_id_list) != 0) else ind if corr_id in to_us_dict: - (from_ts, from_tid) = from_us_list[ind] + (from_ts, from_tid, to_tid) = from_us_list[ind] from_ts -= start_us - to_tid = 0 to_ts = to_us_dict[corr_id] - start_us if from_ts > to_ts: from_ts = to_ts fd.write(',{"ts":%d,"ph":"s","cat":"DataFlow","id":%d,"pid":%d,"tid":%d,"name":"dep"}\n' % (from_ts, dep_id, from_pid, from_tid)) diff --git a/projects/rocprofiler/bin/tblextr.py b/projects/rocprofiler/bin/tblextr.py index 4eef7ea61a..b4ba0d113a 100755 --- a/projects/rocprofiler/bin/tblextr.py +++ b/projects/rocprofiler/bin/tblextr.py @@ -135,6 +135,7 @@ def parse_res(infile): } gpu_id = 0 + queue_id = 0 disp_pid = 0 disp_tid = 0 @@ -149,6 +150,7 @@ def parse_res(infile): if var == 'gpu-id': gpu_id = int(val) if (gpu_id > max_gpu_id): max_gpu_id = gpu_id + if var == 'queue-id': queue_id = int(val) if var == 'pid': disp_pid = int(val) if var == 'tid': disp_tid = int(val) else: fatal('wrong kernel property "' + prop + '" in "'+ kernel_properties + '"') @@ -172,7 +174,7 @@ def parse_res(infile): if not gpu_pid in dep_proc: dep_proc[gpu_pid] = { 'pid': HSA_PID, 'from': [], 'to': {}, 'id': [] } dep_str = dep_proc[gpu_pid] to_id = len(dep_str['from']) - dep_str['from'].append((from_us, disp_tid)) + dep_str['from'].append((from_us, disp_tid, queue_id)) dep_str['to'][to_id] = to_us ## @@ -367,11 +369,20 @@ def fill_api_db(table_name, db, indir, api_name, api_pid, dep_pid, dep_list, dep record_name = rec_vals[4] record_args = rec_vals[5] + # incrementing per-process record id/correlation id if not proc_id in record_id_dict: record_id_dict[proc_id] = 0 corr_id = record_id_dict[proc_id] record_id_dict[proc_id] += 1 rec_vals.append(corr_id) + # extracting/converting stream id + (stream_id, stream_found) = get_field(record_args, 'stream') + if stream_found != 0: + stream_id = get_stream_index(stream_id) + (rec_vals[5], found) = set_field(record_args, 'stream', stream_id) + if found == 0: fatal('set_field() failed for "stream", args: "' + record_args + '"') + else: stream_id = 0 + # dependencies filling if ptrn_ac.search(record_name) or (corr_id, proc_id) in dep_filtr: beg_ns = int(rec_vals[0]) @@ -382,12 +393,12 @@ def fill_api_db(table_name, db, indir, api_name, api_pid, dep_pid, dep_list, dep dep_proc = dep_dict[proc_id] found = 1 if dep_pid in dep_proc else 0 if found == 0 and dep_pid == OPS_PID: - dep_proc[dep_pid] = { 'pid': api_pid, 'from': [], 'id': [] } - found = 1 + dep_proc[dep_pid] = { 'pid': api_pid, 'from': [], 'id': [] } + found = 1 if found == 1: dep_str = dep_proc[dep_pid] - dep_str['from'].append((from_us, thrd_id)) - if expl_id: dep_str['id'].append(corr_id) + dep_str['from'].append((from_us, thrd_id, stream_id)) + if expl_id: dep_str['id'].append(corr_id)) # memcopy data if len(copy_raws) != 0: @@ -399,13 +410,6 @@ def fill_api_db(table_name, db, indir, api_name, api_pid, dep_pid, dep_list, dep copy_csv += str(copy_index) + ', ' + copy_line + '\n' copy_index += 1 - # extracting/converting stream-id - (stream_id, stream_found) = get_field(record_args, 'stream') - if stream_found != 0: - stream_id = get_stream_index(stream_id) - (rec_vals[5], found) = set_field(record_args, 'stream', stream_id) - if found == 0: fatal('set_field() failed for "stream", args: "' + record_args + '"') - # patching activity properties: kernel name, stream-id if (corr_id, proc_id) in dep_filtr: ops_table_name = dep_filtr[(corr_id, proc_id)]