mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-08-30 02:46:06 +00:00
viz: collapse wave packets in one row, 1 clk per packet (#14169)
* per wave packets in one row * work * row_tuple * cleaner * one row and one lane per wave * globals split into rows based on type * barrier length
This commit is contained in:
@@ -173,7 +173,7 @@ const colorScheme = {TINY:new Map([["Schedule","#1b5745"],["get_program","#1d2e6
|
||||
DEFAULT:["#2b2e39", "#2c2f3a", "#31343f", "#323544", "#2d303a", "#2e313c", "#343746", "#353847", "#3c4050", "#404459", "#444862", "#4a4e65"],
|
||||
BUFFER:["#342483", "#3E2E94", "#4938A4", "#5442B4", "#5E4CC2", "#674FCA"], SIMD:new Map([["OCC", "#101725"], ["INST", "#0A2042"]]),
|
||||
WAVE:new Map([["INST", "#e76f51"], ["VALUINST", "#415a77"], ["IMMEDIATE", "#f3b44a"], ["BARRIER", "#d00000"]]),
|
||||
SHARED:new Map([["VMEMEXEC", "#f4978e"], ["ALUEXEC", "#f72585"]]),}
|
||||
VMEMEXEC:["#f4978e"], ALUEXEC:["#f72585"]}
|
||||
const cycleColors = (lst, i) => lst[i%lst.length];
|
||||
|
||||
const rescaleTrack = (source, tid, k) => {
|
||||
@@ -323,7 +323,7 @@ async function renderProfiler(path, unit, opts) {
|
||||
levels.push(et);
|
||||
} else levels[depth] = et;
|
||||
}
|
||||
if (depth === 0) colorKey = e.name.split(" ")[0];
|
||||
if (depth === 0 || !opts.stepColors) colorKey = e.name.split(" ")[0];
|
||||
if (!colorMap.has(colorKey)) {
|
||||
const color = colors instanceof Map ? (colors.get(colorKey) || colors.get("DEFAULT")) : cycleColors(colors, colorMap.size);
|
||||
colorMap.set(colorKey, d3.rgb(color));
|
||||
@@ -790,7 +790,7 @@ async function main() {
|
||||
}
|
||||
// timeline with cycles on the x axis
|
||||
if (ret instanceof ArrayBuffer) {
|
||||
opts = {heightScale:0.5, hideLabels:true, levelKey:(e) => parseInt(e.name.split(" ")[1].split(":")[1])};
|
||||
opts = {heightScale:0.5, hideLabels:true, levelKey:(e) => parseInt(e.name.split(" ")[1].split(":")[1]), stepColors:!step.name.includes("Packets")};
|
||||
return renderProfiler(ckey, "clk", opts);
|
||||
}
|
||||
metadata.innerHTML = "";
|
||||
|
||||
+10
-10
@@ -218,7 +218,8 @@ def soft_err(fn:Callable):
|
||||
try: yield
|
||||
except Exception: fn({"src":traceback.format_exc()})
|
||||
|
||||
def row_tuple(row:str) -> tuple[int, ...]: return tuple(int(ss[1]) if len(ss:=x.split(":"))>1 else 999 for x in row.split())
|
||||
def row_tuple(row:str) -> tuple[tuple[int, int], ...]:
|
||||
return tuple((ord(ss[0][0]), int(ss[1])) if len(ss:=x.split(":"))>1 else (999,999) for x in row.split())
|
||||
|
||||
# *** Performance counters
|
||||
|
||||
@@ -279,18 +280,17 @@ def sqtt_timeline(e) -> list[ProfileEvent]:
|
||||
from extra.assembly.amd.sqtt import decode, PacketType, INST, InstOp, VALUINST, IMMEDIATE, VMEMEXEC, ALUEXEC
|
||||
ret:list[ProfileEvent] = []
|
||||
rows:dict[str, None] = {}
|
||||
def add(name:str, p:PacketType, op="OP", idx=0, width=5) -> None:
|
||||
rows.setdefault(r:=(f"WAVE:{p.wave} {name}:1" if hasattr(p, "wave") else f"SHARED:0 {name}:0"))
|
||||
ret.append(ProfileRangeEvent(r, f"{name} {op}:{idx}", Decimal(p._time), Decimal(p._time+width)))
|
||||
op_idx:dict = {}
|
||||
def add(name:str, p:PacketType, idx=0, width=1) -> None:
|
||||
rows.setdefault(r:=(f"WAVE:{p.wave}" if hasattr(p, "wave") else f"{p.__class__.__name__}:0 {name}"))
|
||||
ret.append(ProfileRangeEvent(r, f"{name} OP:{idx}", Decimal(p._time), Decimal(p._time+width)))
|
||||
for p in decode(e.blob):
|
||||
if len(ret) > 50_000: break
|
||||
if isinstance(p, INST):
|
||||
if p.op not in op_idx: op_idx[p.op] = len(op_idx)
|
||||
op_name, idx = (p.op.name, op_idx[p.op]) if isinstance(p.op, InstOp) else (f"0x{p.op:02x}", len(op_idx))
|
||||
if "BARRIER" in op_name: add("BARRIER", p, op_name, width=100)
|
||||
else: add(p.__class__.__name__, p, op_name, idx)
|
||||
if isinstance(p, (VALUINST, IMMEDIATE, VMEMEXEC, ALUEXEC)): add(p.__class__.__name__, p)
|
||||
op_name = p.op.name if isinstance(p.op, InstOp) else f"0x{p.op:02x}"
|
||||
name, width = (op_name, 10) if "BARRIER" in op_name else (f"INST {op_name}", 1)
|
||||
add(name, p, width=width)
|
||||
if isinstance(p, (VALUINST, IMMEDIATE)): add(p.__class__.__name__, p)
|
||||
if isinstance(p, (VMEMEXEC, ALUEXEC)): add(str(p.src).split('.')[1], p)
|
||||
return [ProfilePointEvent(r, "start", r, ts=Decimal(0)) for r in rows]+ret
|
||||
|
||||
# ** SQTT OCC only unpacks wave start, end time and SIMD location
|
||||
|
||||
Reference in New Issue
Block a user