End stitch on unknown jump location

Change-Id: I7a3bcdc6f06fa464950cd67019f947502afc4c26


[ROCm/rocprofiler commit: 8d2903c7cb]
这个提交包含在:
Giovanni LB
2023-03-03 00:51:58 -03:00
提交者 Ammar ELWazir
父节点 9c93ea9a95
当前提交 461dadf26e
修改 2 个文件,包含 23 行新增24 行删除
+14 -16
查看文件
@@ -70,7 +70,8 @@ def stitch(insts, code, jumps):
mem_unroll = []
flight_count = []
ordering = 0 # 0 for in order, 1 for ongoing flats and 2 for SMEM
smem_ordering = 0
vmem_ordering = 0
while i < N:
inst = insts[i]
if line >= len(code):
@@ -85,14 +86,15 @@ def stitch(insts, code, jumps):
num_inflight = NUM_FLAT + NUM_SMEM + NUM_VMEM
if inst[1] == 1 or inst[1] == 5: # SMEM, LDS
ordering = 2 if inst[1] == 1 else ordering
smem_ordering = 2 if inst[1] == 1 else smem_ordering
SMEM_INST.append([line, num_inflight])
NUM_SMEM += 1
elif inst[1] == 3 or (inst[1] == 4 and 'global_' in as_line[0]): # VMEM R/W
VMEM_INST.append([line, num_inflight])
NUM_VMEM += 1
elif inst[1] == 4: # FLAT
ordering = max(ordering, 1)
smem_ordering = max(smem_ordering, 1)
vmem_ordering = 1
FLAT_INST.append([line, num_inflight])
NUM_FLAT += 1
elif inst[1] == 9 and 'waitcnt' in as_line[0]:
@@ -101,8 +103,8 @@ def stitch(insts, code, jumps):
wait_N = int(as_line[0].split('lgkmcnt(')[1].split(')')[0])
flight_count.append([as_line[-1], num_inflight, wait_N])
if wait_N == 0:
ordering = 0
if ordering == 0:
smem_ordering = 0
if smem_ordering == 0:
offset = len(SMEM_INST)-wait_N
mem_unroll.append( [line, SMEM_INST[:offset]+FLAT_INST] )
SMEM_INST = SMEM_INST[offset:]
@@ -116,9 +118,9 @@ def stitch(insts, code, jumps):
if 'vmcnt' in as_line[0]:
wait_N = int(as_line[0].split('vmcnt(')[1].split(')')[0])
flight_count.append([as_line[-1], num_inflight, wait_N])
if wait_N == 0 and ordering != 2:
ordering = 0
if ordering == 0:
if wait_N == 0:
vmem_ordering = 0
if vmem_ordering == 0:
offset = len(VMEM_INST)-wait_N
mem_unroll.append( [line, VMEM_INST[:offset]+FLAT_INST] )
VMEM_INST = VMEM_INST[offset:]
@@ -129,9 +131,11 @@ def stitch(insts, code, jumps):
NUM_VMEM = min(max(wait_N-NUM_FLAT, 0), NUM_VMEM)
NUM_FLAT = min(max(wait_N-NUM_VMEM, 0), NUM_FLAT)
elif inst[1] == 7 and as_line[1] == 10: # jump
matched, next = True, as_line[2]
if next is None or next == 0:
print('Jump to unknown location!', as_line)
return result, loopCount, mem_unroll, flight_count
elif inst[1] == 8 and as_line[1] == 10: # next
matched, next = True, line + 1
else:
@@ -141,11 +145,6 @@ def stitch(insts, code, jumps):
next = line + 1
if i+1 < N and line+1 < len(code):
if try_match_swapped(insts, code, i, line):
#print('Swap:', code[line])
#print('For:', code[line+1])
#result += (*(insts[i+1]), line),
#result += (*inst, line+1),
#i, next = i+2, line+2
temp = insts[i]
insts[i] = insts[i+1]
insts[i+1] = temp
@@ -162,10 +161,8 @@ def stitch(insts, code, jumps):
N = max(N, 1)
if len(result) != N:
print('Warning - Stitching rate: '+str(len(result) * 100 / N)+'% matched')
return result, loopCount, mem_unroll, flight_count
def extract_tuple(content, num):
vals = content.split(',')
assert (len(vals) == num)
@@ -301,6 +298,7 @@ def extract_data(df, output_ui, se_number, code, jumps):
OUT = output_ui+'/ui/se'+str(se_number)+'_sm'+str(df['simd'][wave_id])+\
'_wv'+str(df['wave_slot'][wave_id])+'.json'
#'_wv'+str(wave_id)+'.json'
with open(OUT, 'w') as f:
f.write(json.dumps(data_obj))
@@ -43,9 +43,9 @@
</div>
<div id="minimap"></div>
<div id="ma_code">
<ul id="code" style="position: absolute; top:610px; left:80px"></ul>
<ul id="code" style="position: absolute; top:610px; left:390px"></ul>
</div>
<canvas id="arrows" width="100px" height="500px" style="position: absolute; top:630px; left:1px;"></canvas>
<canvas id="arrows" width="400px" height="500px" style="position: absolute; top:630px; left:1px;"></canvas>
<script src="https://cdn.jsdelivr.net/npm/d3@7.0.0/dist/d3.min.js"></script>
<script>
@@ -105,7 +105,8 @@
}
}
}
var spacing = 80.0 / max_slots
var spacing = 380.0 / max_slots
if (spacing > 10) spacing = 10;
var connect = []
for(const f in offsets) { connect.push([]) };
@@ -135,19 +136,19 @@
for(var s=smin; s<=smax; s++)
slots[s] -= 1
var xpos = 80 - spacing*waitcnt[w][1][l][1]
var xpos = 380 - spacing*waitcnt[w][1][l][1]
const ypos = offsets[elem];
var wnc_y = y0;
if(ypos > y0) { wnc_y += 3; }
else { wnc_y -= 3; }
DrawArrow(ctx, 87, ypos);
DrawArrow(ctx, 387, ypos);
ctx.fillRect(xpos, wnc_y, 3, ypos-wnc_y);
ctx.fillRect(xpos, wnc_y-1.5, 87-xpos, 3);
ctx.fillRect(xpos, ypos-1.5, 87-xpos, 3);
DrawArrow(ctx, 87, wnc_y);
ctx.fillRect(xpos, wnc_y-1.5, 387-xpos, 3);
ctx.fillRect(xpos, ypos-1.5, 387-xpos, 3);
DrawArrow(ctx, 387, wnc_y);
color_count += 1;
}
}